Skip to content

Instantly share code, notes, and snippets.

@farinspace
Last active Jul 16, 2018
Embed
What would you like to do?
MacOS X postfix relyhost mail setup
...
# append to /etc/postfix/main.cf
relayhost=smtp.sendgrid.net:587
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options=
smtp_use_tls=yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandom
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.postfix.custom</string>
<key>Program</key>
<string>/usr/libexec/postfix/master</string>
<key>QueueDirectories</key>
<array>
<string>/var/spool/postfix/maildrop</string>
</array>
<key>AbandonProcessGroup</key>
<true/>
<key>OnDemand</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
smtp.sendgrid.net:587 [email]:[password]
# create empty file
sudo touch /etc/postfix/sasl_passwd
# set permissions before entering credentials
sudo chmod go-rwx /etc/postfix/sasl_passwd
# setup credentials
sudi vi /etc/postfix/sasl_passwd
# create lookup table
sudo postmap /etc/postfix/sasl_passwd
# for extra security, remove file once lookup table is created
sudo rm /etc/postfix/sasl_passwd
# create a backup copy
sudo cp /etc/postfix/main.cf /etc/postfix/main.cf~orig
# append config
sudo vi /etc/postfix/main.cf
# create service config
sudo vi /Library/LaunchDaemons/org.postfix.custom.plist
# add mac os service service (be sure correct permissions are set; root:wheel)
sudo launchctl load /Library/LaunchDaemons/org.postfix.custom.plist
# restart macOS to confirm auto loading on boot
# confirm postfix process is running
ps -A | grep postfix
@farinspace

This comment has been minimized.

Copy link
Owner Author

@farinspace farinspace commented Jul 16, 2018

tested macOS High Sierra 10.13.5

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