Skip navigation

Monthly Archives: August 2013

I need to be able to relay mail over SMTP from a sendmail instance on Fedora, through Google Mail servers. This is how I did it.

(Make sure you have the m4, sendmail, and sendmail-cf package installed.)

In the client auth config (/etc/mail/auth/client-info):

AuthInfo:smtp.gmail.com "U:root" "I:myusername@gmail.com" "P:password" "M:PLAIN"
AuthInfo:smtp.gmail.com:587 "U:root" "I:myusername@gmail.com" "P:password" "M:PLAIN"

Create the client info database file:

sudo makemap -r hash client-info.db
sudo chmod 600 /etc/mail/auth/client-info
sudo chmod 600 /etc/mail/auth/client-info.db

UPDATE: The above stopped working for me as of Fedora 19, the following is what I had to use to update the client-info.db:

cd /etc/mail/auth
sudo makemap -v hash client-info.db < client-info
sudo chmod 600 /etc/mail/auth/client-info
sudo chmod 600 /etc/mail/auth/client-info.db

The M4 configuration:

Feature	FEATURE(`authinfo',`hash /etc/mail/auth/client-info.db')dnl	
Define	define(`SMART_HOST',`smtp.gmail.com')dnl	
Define	define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl	
Define	define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl	
Define	define(`CERT_DIR', `/etc/mail/ssl')dnl	
Define	define(`confCACERT_PATH', `CERT_DIR')dnl	
Define	define(`confCACERT', `CERT_DIR/ca-bundle.crt')dnl	
Define	define(`confCRL', `CERT_DIR/ca-bundle.crt')dnl	
Define	define(`confSERVER_CERT', `CERT_DIR/sendmail.pem')dnl	
Define	define(`confSERVER_KEY', `CERT_DIR/sendmail.pem')dnl	
Define	define(`confCLIENT_CERT', `CERT_DIR/sendmail.pem')dnl	
Define	define(`confCLIENT_KEY', `CERT_DIR/sendmail.pem')dnl	
Define	define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN') TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

Rebuild the config:

m4 sendmail.mc > sendmail.cf

If you run into SELinux denials, check your sendmail flags with:
sestatus -b | grep -i sendmail
If you see 'http_can_sendmail' is off, issue setsebool -P httpd_can_sendmail 1