Linux: Using sendmail from console
To send an email from console you need to use mail command, which 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 protected] you need to type following command:
$ mail [email protected]:
Subject: Hello
Hai,
How are you? Hope so you are fine 🙂
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 then use following command:
$ mail -s ‘Hai’ [email protected] < /tmp/messagePlease note that above command will NOT route an email if you do not have properly configured MTA/mail server.
By Vivek Gite