Skip to content

Instantly share code, notes, and snippets.

@binarytemple
Forked from angrycub/configuration.md
Created October 17, 2017 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binarytemple/04fb404277a92ab66dc1370b9ac843ae to your computer and use it in GitHub Desktop.
Save binarytemple/04fb404277a92ab66dc1370b9ac843ae to your computer and use it in GitHub Desktop.
Configuring PostFix on OSX 10.10

##Configure Postfix for Gmail SMTP## ###Edit file /etc/postfix/main.cf###

sudo vim /etc/postfix/main.cf

and add in the following to the bottom of the file:

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
smtp_use_tls = yes

###Generate sasl_password if not already exists###

sudo vim /etc/postfix/sasl_passwd

and enter in the following:

[smtp.gmail.com]:587 username@gmail.com:password

Run the following commands

sudo chmod 600 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
sudo launchctl stop org.postfix.master
sudo launchctl start org.postfix.master

And you are done….

###Test your configuration### Now, you should be able to send emails from within the command line e.g. to send the contents of a directory as a tree to an email address

echo "This is a test" | mail -s "Test email from PostFix" your@yourdomain.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment