Linux send email 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 somewhere@domain.com you need to type following command:
$ mail somewhere@domain.comOutput:
Subject: Hello Hai, How are you? Hope so you are fineTake 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' somewhere@domain.com < /tmp/messagePlease note that above command will NOT route an email if you do not have properly configured MTA/mail server.
See also:
E-mail this to a friend
Printable version
Related Other Helpful FAQs:
- How do I send html email from Perl?
- See what is going on the Linux console screen
- Sending mail with Perl mail script
- Postfix setup catch-all email accounts using /etc/postfix/virtual
- Debian / Ubuntu Linux: Send Automatic Email Notification When Security Upgrades Available
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!



March 3rd, 2008 at 10:37 am
Thank you, I tried that command and it warked so fin.
May 28th, 2008 at 1:00 pm
Hi,
I am not able to send mail using mail utility,
I used
mail -s “Subject” somewhere@domain.com
the moment I am sending mail, its getting bounced to delively failed list. I have tried several attempts, it not working. Do I have to configure some server like pop3 before I go ahead and send mail ?
Please help in this regard.
Thanks
Syed Mateen
May 28th, 2008 at 1:32 pm
Hi,
How to configure MTA/mail server ?
Please clarify ?
Thanks
Syed Mateen.