Command line email help needed


 
Thread Tools Search this Thread
Operating Systems Linux Ubuntu Command line email help needed
# 1  
Old 11-18-2010
Command line email help needed

Hi,

having some problems getting commandline mail to work for root user in ubuntu.
Ive installed the following packages - msmtp & mailx and the cert for gmail.

I've created 3 files: mailrc and msmtprc in /home/username directory
and /etc/exim4/passwd.client

mailrc
------
set from="USER@gmail.com (ME)"
set sendmail="/usr/bin/msmtp"
set message-sendmail-extra-arguments="-a gmail"

MSMTPRC
-------
# config options: msmtp 1.4.21
#A-user-configuration-file
defaults
logfile /tmp/msmtp.log

# gmail account
account gmail
auth on
host smtp.gmail.com
port 587
user USER@ mail.com
password PASSWORD
from USER@gmail.com
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
#set default account to use (not necessary with single account)
account default : gmail

passwd.client
-------------
*.google.com:yourAccountName@gmail.com:y0uRpaSsw0RD

Then issuing the command
echo "test" | mailx -s "this is a test" myemail@gmail.com

Works perfectly for normal user accounts, but when I try to do the same with root I get the following error

'send-mail: /root/.msmtprc: line 16: unknown command set
Can't send mail: sendmail process failed'

There is no 'msmtprc' config file in /root and even when created I get the same error.

Im totally confused to why its displaying the error, also no logfile is created.

Any help would be gratefully received.

Thanks, Lee.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting email output in single line with out space in email

I have tried below email method and i am getting every thing in single line . i have put echo to provide space, but it is not helping my code ( echo "From: $FROM" echo "To: $MAILTO" echo "CC: $CC" echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo 'Content-Type: multipart/mixed;... (6 Replies)
Discussion started by: mirwasim
6 Replies

2. Shell Programming and Scripting

Help needed for sending email attachment

Hi Please help me how to send email attchment from linux server to outlook id I dont have uuencode or mutt installed on my machine and below is my uname -a output: Linux xxxxxxx 2.6.18-308.4.1.el5 #1 SMP Wed Mar 28 01:54:56 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux (7 Replies)
Discussion started by: buzzme
7 Replies

3. Shell Programming and Scripting

Using top command to email if process is exceeding 25% and sending an email alert if so

This is my first time writing a script and Im having some trouble, Im trying to use the top command to monitor processes and the amount of CPU usage they require, my aim is to get an email if a process takes over a certain percentage of CPU usage I tried grep Obviosly that hasnt worked, Any... (8 Replies)
Discussion started by: jay02
8 Replies

4. UNIX Desktop Questions & Answers

Send Email from command line in Ubuntu 11.10

Have problem to send email from command line according to the posts like this one: To have the ability to send email from the command line, you will need to install the mailutils and postfix packages with the following commands. apt-get install mailutils apt-get install postfix Now... (1 Reply)
Discussion started by: yifangt
1 Replies

5. Shell Programming and Scripting

Help needed to send email

Hi , Below is the part of Ksh.I have written. The sql below generates list of records for undelivered letters. ## - spool undelivered letter list cd $cs_LOG $ORACLE_BIN/sqlplus $USER/$PASS @$cs_PROG/spool_undelivered_letters.sql The below Ksh check for the file and send emails. ... (1 Reply)
Discussion started by: sithara
1 Replies

6. Shell Programming and Scripting

Help needed to send email

Hi , Below is the part of Ksh.I have written. The sql below generates list of records for undelivered letters. ## - spool undelivered letter list cd $cs_LOG $ORACLE_BIN/sqlplus $USER/$PASS @$cs_PROG/spool_undelivered_letters.sql The below Ksh check for the file and send emails. ... (3 Replies)
Discussion started by: sithara
3 Replies

7. UNIX for Dummies Questions & Answers

Cron to delete email help needed

I would like to know if I can place a cron job (and what it might be of course) to delete all the mail in an inbox? Here are the servers specs: Operating systemLinuxService StatusClick to ViewKernel version2.6.28.9Machine Typei686Apache version2.2.11 (Unix)PERL version5.8.8Path to... (2 Replies)
Discussion started by: markmatu
2 Replies

8. UNIX for Advanced & Expert Users

use email subject line as shell command

If anyone can give me some ideas on this it would be great. What I'm trying to do is to have emails be sent to my unix account. Once they are emailed to the unix account, I want to use the text in the subject field to invoke a shell script, so basically I need to find a way that I can... (4 Replies)
Discussion started by: mskarica
4 Replies

9. UNIX for Advanced & Expert Users

create email w/ ASCII attachment via command-line

All, I need to email an ASCII data file to a business partner, and intended on creating a Korn Shell script to create an email message (minimal text), and attach the ASCII data file to the email. It seems this is not as easy as I had thought it might be. sendmail does not support... (3 Replies)
Discussion started by: jwperry
3 Replies
Login or Register to Ask a Question