Wednesday, December 4, 2013

Smarthost With SMTP Authentication For Sendmail

First we have to create the authentication information
cd /etc/mail
mkdir auth
chmod 700 auth
cd auth
vi client-info
Enter the following, substituting the desired mail server, username and password
AuthInfo:mail.server.com "U:username" "P:password"
Now we create the hash
makemap hash client-info < client-info
chmod 600 client-info*
cd /etc/mail
vi sendmail.mc
Now we tell sendmail to smarthost and use our authentication hash, substituting the desired mail server
define(`SMART_HOST',`mail.server.com')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
Find the existing line for smarthost and replace it with those three lines.

Lastly, rebuild the config and restart sendmail
m4 sendmail.mc > sendmail.cf
service sendmail restart

No comments:

Post a Comment