Tuesday, July 24, 2012

send mails from the command prompt

                   send mails from command prompt

if you would like to send the mails from command prompt, then you have to install this setup in your local systems and servers also


#apt-get install heirloom-mailx
#apt-get install mailutils
#apt-get install ssmtp

Edit the configuration file as shown below
#vim /etc/ssmtp/ssmtp.conf

comment all the lines in the file then after enter the below data

root=yourmailid@gmail.com.com
mailhub=smtp.gmail.com:25
hostname=sandeep
AuthUser=youremailid@gmail.com
AuthPass=*********  (password of the mail id account)
UseSTARTTLS=yes
UseTLS=yes
FromLineOverride=YES

:wq!

Then go to the configuration file from which account you would like send the mails

#vim /etc/ssmtp/revaliases

root:yourmailid@gmail.com:smtp.exleaz.com:25
:wq

Then in this configuration file give your account name

#vim /var/mail/account_name

root

:wq


after this test by sending a mail like this

#echo "hi how are you" | mail -s 'test' maild id which you want to send the mail
then the meaasge will be delivered to your account

1 comment:

  1. please write your comments below, for our improvement of the blog

    ReplyDelete