sSMTP is alternative to Sendmail. sSMTP is a send-only sendmail emulator for machines which normally pick their mail up from a centralized mailhub (via pop, imap, nfs mounts or other means). It provides the functionality required for humans and programs to send mail via the standard or /usr/bin/mail user agents. It is used to send mail to external email address after authentication with valid mail account.
Download & Install
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# yum -y install ssmtpNow we will edit the ssmtp configuration file.
# cd /etc/ssmtp
# vim /etc/ssmtp/ssmtp.confHere 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 mail account
AuthPass=myemailpassword # The password for the mail account
Now let’s configure 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 "From" Display Name, edit the /etc/passwd and modify the user 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/bashBefore we start using sSMTP lets stop the sendmail which is default installed on all Linux distribution.Stop sendmail service to start after reboot
# service sendmail stop
# sudo chkconfig --levels 2345 sendmail offMove or replace the sendmail and then create a symbolic link for sSMTP to sendmail with authentication
# mv /usr/sbin/sendmail /usr/sbin/sendmail.orig
# ln -s /usr/sbin/ssmtp /usr/sbin/sendmailWe all done with the installation and configuration let’s send a test mail to internal & external email address using sSMTP.
echo "Sending Test mail to external & Internal email address"| mail -s "This is the test message using sSMTP" bala@techgyaan.org bala@gmail.com
Feedbacks: We appreciate your feedbacks and suggestions about our website bala@techgyaan.org
Check out Bala's Google+ profile. Follow @techgyaan

Comments
Post a Comment