Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On Ubuntu 13.04 I have been trying to send emails from the command line but the mail command will not return. I am running these from inside a putty terminal:

sudo apt-get install mailutils
sudo apt-get install sendemail
echo "test message" | sendmail -s 'test subject' me@gmail.com

or

sendmail -s "test" me@gmail.com < out

both hange so the the cursor does not return to the command prompt. I have also tried other variations using mail,ssmtp, and postfix (also installed them all). They all do the same thing. For ssmtp I added config like this:

root=aaaa@gmail.com 
mailhub=smtp.gmail.com:465 
rewriteDomain=gmail.com 
AuthUser=aaaa
AuthPass=pass
FromLineOverride=YES
share|improve this question
    
Which package does provide your sendmail? dpkg -S `which sendmail` –  Andrzej A. Filip Jul 17 '13 at 6:30
    
dpkg -S `which sendmail` => ssmtp: /usr/sbin/sendmail –  Nash0 Jul 17 '13 at 11:19

2 Answers 2

Try this, it works for 12.04 and I'm sure they haven't changed the package that much

apt-get install bsd-mailx

Then you can send mail like

echo "hi there" | mail -s "subject here" me@gmail.com
share|improve this answer
    
Same result, also tried running with bsd-mailx to ensure I was running that version. No luck. –  Nash0 Jul 17 '13 at 5:39
    
you'd have to post your parts of your mail.log to see if there is a reason there –  Mike Jul 17 '13 at 5:41
    
mail -v returns no mail for username and the mail.log has sSMTP[14573]: Unable to locate mail\n sSMTP[14573]: Cannot open mail:25 –  Nash0 Jul 17 '13 at 11:46
    
you need to show your /var/log/mail.log entries is what i meant –  Mike Jul 17 '13 at 12:46

Try the collowing test commands:

(echo "subject: test"; echo) | /usr/sbin/sendmail -i me@gmail.com
(echo "subject: test"; echo) | /usr/sbin/sendmail -v -i me@gmail.com
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.