1. First step : Install sSMTP Packages :
# yum -y install ssmtp
2. Now we will edit the ssmtp configuration file.
# cd /etc/ssmtp
Here is the custom configuration(here we use gmail account)
# vim /etc/ssmtp/ssmtp.conf
root=**********@gmail.com
## Redirect mail for root@ to postmaster@
MailHub=smtp.gmail.com:587 ## SMTP server hostname and port
AuthUser=*****@gmail.com ## Your DreamHost mailaccount
AuthPass=## The password for the mail account
UseSTARTTLS=YES ## The password for the mail account
UseTLS=NO # Secure connection (SSL/TLS)
FromLineOverride=YES # Force the From: line
Hostname=mail.gmail.com # The name of this host
RewriteDomain=mail.gmail.com
# The host the mail appears to be coming from
## Compulsory field.
3. If you would like to change the “From“Display Name, edit the /etc/passwd and modify the user alias
# vim /etc/passwd
user1:User1:507:507::/home/user1:/bin/bash
Note :Before we start using sSMTP need to stop the sendmail.
# service sendmail stop
# sudo chkconfig –levels 2345 sendmail off
4. Move or replace the sendmail and thencreate a symbolic link for sSMTP to sendmail with authentication.
# mv /usr/sbin/sendmail/usr/sbin/sendmail.ori
# ln -s /usr/sbin/ssmtp/usr/sbin/sendmail
5.Now it's time to test sSMTP.
# echo”Sending Test mail to external & Internal email address”|
mail -s”this is the test msg using sSMTP” testssmtp@yahoo.com