Why am I not able to send an email from command line

This is what I did (as per a few discussions on this website)

mail -s "hi" [email protected] < test.txt

Where text.txt has the message.

I checked to see if mail did exist and it does at /usr/bin/mail

What am I missing? Is there a daemon that must be running? Is there more to this?

I am running Ubuntu 11.10


You need to install several packages namely as follows

 postfix mailutils libsasl2-2 ca-certificates libsasl2-modules

these packages are required for the proper setup of mail sending. Here is a proper way of setting this up and testing out by sending mail and the possible troubleshooting. Hope this helps :)


You will need to install a mail transfer agent. I would suggest Postfix, since it is widely used and has a good security record:

sudo apt-get install postfix

You should be asked a few questions about how you want to configure Postfix. If your ISP requires you to send email via their SMTP server, choose the "Satelite system" option and enter their SMTP server as the relay host. Otherwise, the "Internet site" option is probably best.

With that set up, the mail command line tool should be able to deliver email (along with anything else that relies on the /usr/lib/sendmail API).