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@
[email protected]           # Your DreamHost mailaccount
AuthPass=myemailpassword              # The password for the mail account
Now let’sconfigure the Aliases
# vim /etc/ssmtp/revaliases
root:[email protected]:mail.techgyaan.org:25
 Postmaster:[email protected]:mail.techgyaan.org:25
 Bala:[email protected]: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:Alerts:507:507::/home/alerts:/bin/bash
bala:BALA: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 & Internal email address”| mail -s”This is the test message using sSMTP” [email protected]@gmail.com

Источник

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

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

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

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