How do I send an email using command line under Linux?
To send an email from console you need to use the mail command. It is an intelligent mail processing system which has a command syntax reminiscent of ed with lines replaced by messages. To send an email to email@example.com you need to type the following command:
$ mail firstname.lastname@example.org
Subject: Hello Hai, How are you? Take care, Babai Vivek . <Type DOT (.) followed by ENTER KEY> Cc: <Press ENTER KEY>
You need to type . (dot) to send an email. To send contains of file (such as /tmp/message) as mail body, use the following syntax:
$ mail -s 'Hai' email@example.com < /tmp/message
Please note that above command will NOT route an email if you do not have properly configured MTA/email/ISP server that accepts forwarding from your shell account. You can also use gmail account to forward email (i.e. relay email) as described here.