How to install and configure sSMTP on CentOS / Fedora / Redhat

sSMTP is alternative to Sendmail. which is send the mail from existing mail server like gmail, yahoo or own server. This program to send mail via standard or /usr/bin/mail useragents. it is used to send mail to external mail addr after authentication with account It's also use in nagios, install in nagios server and add the admin email address entry in Contact.cfg file.

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

## Redirect mail for root@ to postmaster@ ## SMTP server hostname and port
AuthUser=***** ## 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 # The name of this host
# 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 

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”

Post a Comment

Mới hơn Cũ hơn