Friday, June 06, 2008
Configuring Postfix to relay email through your Gmail account on OS X Leopard
Configure Postfix to launch at startup on OS X Leopard describes how to launch postfix at startup. But many ISPs block the SMTP port 25 for at least some hosts in an effort to prevent spam from originating from their network. This may prevent your postfix server from successfully delivering mail to some or all email addresses.
Since the file and its hash will have your password, make sure they're readable only by the root user:
Next, you will need to grab the Thawte Premium root certificates from https://www.verisign.com/support/roots.html. Don't let your browser unzip these when you download them, you'll unzip them in the next step.
If you have a Google Mail account, you can easily configure postfix to relay your email through Gmail. Many thanks to Installation Experiences (see the References below) who provided all the instructions how to do this.
First, "sudo vi /etc/postfix/relay_password" and insert the following content:
smtp.googlemail.com youremail@gmail.com:yourpassword
smtp.gmail.com youremail@googlehosteddomain.com:yourpassword
Now use postmap to hash the file:
sudo postmap /etc/postfix/relay_password
sudo chmod 600 /etc/postfix/relay_password
sudo chmod 600 /etc/postfix/relay_password.db
sudo mkdir /etc/postfix/certs
cd /etc/postfix/certs
sudo unzip -j roots.zip
sudo openssl x509 -inform der -in ThawtePremiumServerCA.cer -out
ThawtePremiumServerCA.pem
sudo c_rehash /etc/postfix/certs
Now configure postfix by adding the following to the bottom of /etc/postfix/main.cf:
relayhost = smtp.googlemail.com:587
# auth
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_password
smtp_sasl_security_options = noanonymous
# tls
smtp_tls_security_level = may
smtp_tls_CApath = /etc/postfix/certs
smtp_tls_session_cache_database = btree:/etc/postfix/smtp_scache
smtp_tls_session_cache_timeout = 3600s
smtp_tls_loglevel = 1
tls_random_source = dev:/dev/urandom
That should be it, just run a quick test by sending mail to yourself using "/usr/bin/mail ". You can watch the maillog from Console.app (in Applications/Utilities)
References
- http://www.installationexperiences.com/?p=87 has great instructions on how to do this, although there were a few bugs in the original post which haven't been corrected as of this writing.
Comments:
Post a Comment