You are here
Sendmail Relay through authenticated smtp server
Other day I needed to make Linux machine using Sendmail on Verizon dynamic IP relay through an Authenticated SMTP server. In this case 1and1.com smtp server but will also work with gmail.
Backup all files:
*****************************************
cp /etc/mail/sendmail.mc /etc/mail/sendmail.mc.bak
cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.bak
cp /etc/mail/authinfo.db /etc/mail/authinfo.db.bak
cp /etc/mail/authinfo /etc/mail/authinfo.bak
*****************************************
Modify sendmail mc file:
*****************************************
vi /etc/mail/sendmail.mc
MASQUERADE_AS(`dfwavc.com')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl
MASQUERADE_DOMAIN(pbx.dfwavc.com)dnl
MASQUERADE_DOMAIN(pbx.local)dnl
MASQUERADE_DOMAIN(dfwavc.com)dnl
define(`SMART_HOST', `smtp.1and1.com')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')
define(`ESMTP_MAILER_ARGS', `TCP $h 587')
FEATURE(`authinfo',`hash -o /etc/mail/authinfo.db')dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
dnl MAILER(cyrusv2)dnl
*********************************************
Generate compiled file that sendmail uses:
*********************************************
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
*********************************************
Modify the password file:
*********************************************
vi /etc/mail/authinfo
AuthInfo:1and1.com "U:shanon@dfwavc.com" "P:PaSsWord" "M:PLAIN"
AuthInfo:1and1.com:587 "U:shanon@dfwavc.com" "P: PaSsWord " "M:PLAIN"
AuthInfo: "U:shanon@dfwavc.com" "P: PaSsWord " "M:PLAIN"
*********************************************
Generate the file that sendmail uses:
*********************************************
makemap -r hash /etc/mail/authinfo.db < /etc/mail/authinfo
*********************************************
Restart sendmail to use the new files:
*********************************************
/etc/init.d/sendmail restart
*********************************************
References:
http://tech.bluesmoon.info/2008/03/gmail-smtp-with-sendmail.html
Contact Us if you would like support or further development.
- shanon's blog
- Log in to post comments