Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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'


sendmail -s "test" < 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: 
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

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"
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
(echo "subject: test"; echo) | /usr/sbin/sendmail -v -i
share|improve this answer

Your Answer


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.