1

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
Nash0
  • 111
  • 1
  • 5

2 Answers2

1

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
Mike
  • 22,310
  • 7
  • 56
  • 79
  • Same result, also tried running with bsd-mailx to ensure I was running that version. No luck. – Nash0 Jul 17 '13 at 05: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 05: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
0

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
AnFi
  • 6,103
  • 1
  • 14
  • 27