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

sSMTP is alternative to Sendmail.  sSMTP is a send-only sendmail emulatorfor machines which normally pick their mail up from a centralized mailhub (viapop, imap, nfs mounts or other means). It provides the functionality requiredfor humans and programs to send mail via the standard or /usr/bin/mail useragents. It is used to send mail to externalemail address after authentication with valid mail account.

Download & Install

# rpm -Uvhhttp://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# yum -y install ssmtp

 

Now we will editthe ssmtp configuration file.

# cd /etc/ssmtp
# vim /etc/ssmtp/ssmtp.conf
Here is the custom configuration 
MailHub=mail.techgyaan.org:25  
# SMTP server hostname and port
UseTLS=NO                             # Secure connection (SSL/TLS)
FromLineOverride=YES                  # Force the From: line
Hostname=mail.techgyaan.org           # The name of this host
RewriteDomain=mail.techgyaan.org      # The host the mail appears to be coming from
Root=Bala                             # Redirect mail for root@ to postmaster@
AuthUser=bala@techgyaan.org           # Your DreamHost mailaccount
AuthPass=myemailpassword              # The password for the mail account
Now let’sconfigure the Aliases
# vim /etc/ssmtp/revaliases
root:alerts@techgyaan.org:mail.techgyaan.org:25
 Postmaster:alerts@techgyaan.org:mail.techgyaan.org:25
 Bala:bala@techgyaan.org:mail.techgyaan.org:25

If you would like to change the “FromDisplay Name, edit the /etc/passwd and modify theuser alias

# vim /etc/passwd
alerts:<strong>Alerts</strong>:507:507::/home/alerts:/bin/bash
bala:<strong>BALA</strong>:505:506::/home/bala:/bin/bash

postmaster:POSTMASTER:505:506::/home/postmaster:/bin/bash

Before we start using sSMTP lets stop thesendmail which is default installed on all Linux distribution.Stop sendmailservice to start after reboot

# service sendmail stop
 # sudo chkconfig –levels 2345 sendmail off

Move or replace the sendmail and thencreate
a symbolic link for sSMTP to sendmail with authentication

# mv /usr/sbin/sendmail/usr/sbin/sendmail.orig
# ln -s /usr/sbin/ssmtp/usr/sbin/sendmail

We all done with the installation andconfiguration let’s send a test mail to internal & external email addressusing sSMTP.

echo”Sending Test mail to external &amp; Internal email address”| mail -s”This is the test message using sSMTP” bala@techgyaan.orgbala@gmail.com

Источник

Запись опубликована в рубрике *Unix,*Linux. Добавьте в закладки постоянную ссылку.

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *

Я не спамер This plugin created by Alexei91