Skip to content

Instantly share code, notes, and snippets.

@qbein
Last active August 29, 2015 14:15
Show Gist options
  • Save qbein/1c2cc13986cfae8b4c21 to your computer and use it in GitHub Desktop.
Save qbein/1c2cc13986cfae8b4c21 to your computer and use it in GitHub Desktop.
Postfix gmail relay OS X 10.9 Maverics
/etc/postfix/main.cf:
# Use gmail as relayhost
relayhost = [smtp.gmail.com]:587
# Map outbound users from local user@host.local to real mail users
smtp_generic_maps = hash:/etc/postfix/generic
# Configure authentication for gmail's TLS requirements
smtp_tls_loglevel=1
smtp_tls_security_level=encrypt
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps=hash:/etc/postfix/passwd
smtp_sasl_security_options = noanonymous
# Most gmail relay online resources does not mention this. I kept getting
# "530-5.5.1 Authentication Required" failures from gmail without this line.
# It's probably some defaults in OS X 10.9 Maverics that is different.
smtp_sasl_mechanism_filter = plain
/etc/postfix/generic:
# Change for your user and/or add others
user@host.local external_user@mail_host
/etc/postfix/passwd:
# Change for your user and/or add others
[smtp.gmail.com]:587 user:pass
$:
# Execute the following in a shell to activate generic and passwd
sudo postmap /etc/postfix/generic
sudo postmap /etc/postfix/passwd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment