Friday, November 7, 2014

How to send email through terminal in ubuntu?

Send Email through Terminal:

For send a email through terminal firstly install the postfix using this

sudo apt-get install postfix
  
Now go to this file

sudo nano /etc/postfix/main.cf

and change

myhostname = example.com

Put in name of your domain into myhostname.

If you want to have mail forwarded to other domains, replace alias_maps with virtual_alias_maps and point it to /etc/postfix/virtual.

virtual_alias_maps = hash:/etc/postfix/virtual

The rest of the lines are set by default. Save, exit, and reload the configuration file to put your changes into effect:

sudo /etc/init.d/postfix reload

Now run this for checking through terminal

sendmail sample-email@example.org

No comments:

Post a Comment