May 15

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
How are you? Hope so you are fine 🙂
Take care
. <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

Copyright 2021. All rights reserved.

Posted May 15, 2012 by Timothy Conrad in category "Linux

About the Author

If I were to describe myself with one word it would be, creative. I am interested in almost everything which keeps me rather busy. Here you will find some of my technical musings. Securely email me using - PGP: 4CB8 91EB 0C0A A530 3BE9 6D76 B076 96F1 6135 0A1B