Skip to content

Instantly share code, notes, and snippets.

@ihortkachuk
Last active December 14, 2015 22:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ihortkachuk/6bb1c87c33b1d89bf195 to your computer and use it in GitHub Desktop.
Save ihortkachuk/6bb1c87c33b1d89bf195 to your computer and use it in GitHub Desktop.
Config Postfix Mac OS X Yosemite 10.10

#Config Postfix Mac OS X Yosemite 10.10

###Step 1. Edit Postfix config file Open a terminal and edit the file main.cf:

sudo vi /etc/postfix/main.cf

First check Postfix is configured correctly, look for the following lines:

mydomain = localhost
mail_owner = _postfix
setgid_group = _postdrop

Now add the following lines at the very end of the file:

#Gmail SMTP
relayhost=smtp.gmail.com:587
# Enable SASL authentication in the Postfix SMTP client.
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options=
# Enable Transport Layer Security (TLS), i.e. SSL.
smtp_use_tls=yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandom
smtp_sasl_mechanism_filter = plain

###Step 2. Create the sasl_passwd file We need to create the sasl_passwd file with the SMTP credentials

sudo vi /etc/postfix/sasl_passwd

Write the following content and save:

smtp.gmail.com:587 youraddress@gmail.com:password

Create the Postfix lookup table from the sasl_passwd file.

sudo postmap /etc/postfix/sasl_passwd

This will create the file sasl_passwd.db

###Step 3. Restart Postfix To apply all new changes we have to restart Postfix:

sudo postfix reload

###Step 4. Test it! Let’s send a mail to our own account to be sure everything is working fine:

date | mail -s testing name@gmail.com

You can check the mail queue and the posible delivery errors using mailq

mailq

Source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment