UnixServerAdmin

Server Administration & Management

How to relay localhost mails to remote smtp server

sSMTP is a simple MTA to deliver mail from a computer to a mail hub (SMTP server). sSMTP is simple and lightweight, there are no daemons or anything hogging up CPU; Just sSMTP. If linux based system have running internet, then we can send email to any account using remote smtp authentication, here is following steps :-

ssmtp download link

# wget dl.fedoraproject.org/pub/epel/5/i386/ssmtp-2.61-15.el5.i386.rpm

# wget dl.fedoraproject.org/pub/epel/5/x86_64/ssmtp-2.61-15.el5.x86_64.rpm

# vim /etc/ssmtp/ssmtp.conf

For StartTLS smtp authentication
###########################################
Root=example@gmail.com
Mailhub=smtp.gmail.com:587
#RewriteDomain=gmail.com
AuthUser=example # (before the @gmail.com part)
AuthPass=example@123
FromLineOverride=Yes
UseSTARTTLS=Yes
AuthMethod=LOGIN
###########################################

For TLS smtp authentication
###########################################
Root=example@gmail.com
Mailhub=smtp.gmail.com:465
#RewriteDomain=gmail.com
AuthUser=example # (before the @gmail.com part)
AuthPass=example@123
FromLineOverride=Yes
UseTLS=Yes
AuthMethod=LOGIN
###########################################

Username :- example
Password :- example@123
Smtp Server :- gmail.com

After done above process, we can also send email through mutt from command line interface (CLI) by following change :-

# vim /root/.muttrc
set sendmail = “/usr/sbin/ssmtp -aexample@gmail.com -apexample@123 -v”

June 13, 2012 - Posted by | Mail, Tips & Tricks, Unix/Linux | , , ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: