Sometimes we need to send email from command line in Ubuntu for administrative tasks.Below steps will show you how to do this which just tested in Ubuntu 12.04
1.Open a terminal by pressing CTL+ALT+t and Install mailutils use below command
sudo apt-get install mailutils
Just follow the instructions and use the default settings during installation.
2.Use below command to send a test email from command line.
echo "This is Content" | sudo mail -s "This is subject" mailaddress
3.Read content from text file as mail content
sudo mail -s "Subject" mailaddress < mail.content
4.You can check log files /var/log/mail.log and /var/log/mail.err if necessary .
1.You can use below command to give a normal user the mail permission(without sudo)
sudo adduser username mail
2.You can use other email applications such as sendmail postfix exim4 to replace mailutils if you prefer