There are cases wherein the mails that are being sent from server does not arrive at the recipient's inbox. One possible cause is that the mail was considered a spam. One solution that can be done, dealing with this issue, is to relay the emails to a trusted SMTP host say like Gmail. How are we going to do it here is how.
First you need to have sendmail a native MTA for Linux. Here are the packages you need to have
- sendmail
- senmail-cf
- sendmail-devel
All of these packages can be installed via yum.
Next enable the smart host feature on sendmail. Open the sendmail configuration file.
vi /etc/mail/sendmail.mc
Change this:
dnl define(`SMART_HOST',`smtp.gmail.com')dnl
to:
define(`SMART_HOST',`smtp.gmail.com')dnl
Next add this entry before the entry of smart host.
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
If you don't have an /etc/mail/auth directory, as root, create one like this:
# mkdir -p /etc/mail/auth
# chmod 700 /etc/mail/auth
You won't have the next client-info files so you'll have to create it (with you favorite Unix editor). Change the permissions on the client-info file like this:
# chmod 600 client-info
So using my user_id@gmail.com email ID and password I made the following entry in /etc/mail/auth/client-info:
# cat /etc/mail/auth/client-info
AuthInfo:smtp.gmail.com "U:smmsp" "I:user_id" "P:password" "M:PLAIN"
AuthInfo:smtp.gmail.com:587 "U:smmsp" "I:user_id" "P:password" "M:PLAIN"
Yes, password is plain text. It is possible to encode the password but I don't have those instructions here.
Remember to replace user_id with your Gmail email ID (your email addresse without the @gmail.com) and password with your email password. Also make sure that the client-info file has a
How to compile it into a db file:
# cd /etc/mail/auth
# makemap -r hash client-info.db <> sendmail.cf
And lastly restart sendmail:
# /sbin/service sendmail restart
Now you can test it....
Hope you find this useful. Thanks, Cheers and God Bless!!!!
No comments:
Post a Comment