Tuesday, July 15, 2014

How to set the From email address for email in command line

If you want that the receiver should get a mail from a particular email id we can use the option of from field, Refer the below example.
  • mail -s "Subject of Mail" recerver@domain.com -- -f  fromfield@domain.com  < /root/content.txt
The double dash stops mail from parsing the -f argument and passes it along to sendmail itself.

content.txt is the file which contains the content to be sent.

No comments:

Post a Comment

Do Write about the Blog and Welcome to the world where open source is every thing :-)