Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save krmnn/d96ff20c1f43eb517ce6db222368cd17 to your computer and use it in GitHub Desktop.
Save krmnn/d96ff20c1f43eb517ce6db222368cd17 to your computer and use it in GitHub Desktop.
Make MacOS send mail over relay via built-in postfix

Make MacOS send mail over relay via built-in postfix

tested with MacOS 10.12.4

  1. Make additions to the end of /etc/postfix/main.cf, see below.
  2. Create /etc/postfix/smtp_sasl_passwords and smtp_generic, see below.
  3. Secure file permissions: chmod 0640 /etc/postfix/smtp_sasl_passwords
  4. Update hashmaps: cd /etc/postfix && postmap smtp_sasl_passwords && postmap smtp_generic
  5. Reload postfix configuration: postfix reload

Test:

% date | mail -s "the date" [email protected]

% date | sendmail -f user@relayhost [email protected]

relayhost = $relayhost:$port
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/smtp_sasl_passwords
smtp_sasl_security_options = noanonymous
smtp_use_tls=yes
smtp_sasl_mechanism_filter = plain
smtp_tls_security_level = encrypt
smtp_tls_loglevel = 2
smtp_generic_maps = hash:/etc/postfix/smtp_generic
user@localhost user@relayhost
$relayhost:$port $user@$relayhost:$password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment