Wednesday, July 18, 2012

Configuring smart host setup with SMTP authentication for Sendmail

This post describes step by step to setup your Sendmail to send email through desired SMTP provider such as your ISP or gmail, etc

Before Sendmail 8.12

1.  Add the below entries in /etc/mail/sendmail.mc file (check if apropriate settings doesn't already exists):
define(`SMART_HOST',`smtp.my.isp.com')
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl

 2. Setup your authorization information by entering below information in /etc/mail/client-info file:

AuthInfo:smtp.my.isp.com "U:smmsp" "I:user" "P:password" "M:PLAIN"

Use your ISP or mail server, Leave "U:smmsp" as is, and update your username and password.

3. Update the configuration files

# cd /etc/mail 
# m4 sendmail.mc >sendmail.cf 
# makemap hash client-info < client-info

You will require sendmail-cf package to update the sendmail.cf file using m4 as above.

4. Set permissions:

# chmod 644 client-info
# chmod 640 client-info.db

5. Reload or restart Sendmail
# /etc/init.d/sendmail restart

Sendmail 8.12 and above:
As of sendmail 8.12 and above, authinfo is built into sendmail.cf so all you have to do is add your "AuthInfo" statement to /etc/mail/access.

1.  Add the below entries in /etc/mail/sendmail.mc file (check if apropriate settings doesn't already exists):
 define(`SMART_HOST',`smtp.my.isp.com')
  2. Setup your authorization information by entering below information in /etc/mail/access file:

AuthInfo:smtp.my.isp.com "U:smmsp" "I:user" "P:password" "M:PLAIN"

Use your ISP or mail server, Leave "U:smmsp" as is, and update your username and password.

3. Update the configuration files

# cd /etc/mail 
# m4 sendmail.mc >sendmail.cf 
# makemap hash access < access


4. Set permissions:

# chmod 644 access
# chmod 640 access.db
 5. Reload or restart Sendmail
# /etc/init.d/sendmail restart

No comments:

Post a Comment