Skip to content

Instantly share code, notes, and snippets.

@veysiertekin
Forked from kany/sendmail_setup.md
Last active December 27, 2018 12:17
Show Gist options
  • Save veysiertekin/9793400ca736736edfb09d6b61c70989 to your computer and use it in GitHub Desktop.
Save veysiertekin/9793400ca736736edfb09d6b61c70989 to your computer and use it in GitHub Desktop.
Setup SENDMAIL on Mac OSX
/usr/sbin/sendmail -t to_mail@gmail.com -s "Test mail" <<EOF
test 1 2 3
4
5 6 7
EOF

SENDMAIL on MAC OSX

  1. Create a file to store our credentials:

    sudo vim /etc/postfix/sasl_passwd

  2. Add something like this:

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

  3. Now run:

    sudo postmap /etc/postfix/sasl_passwd

  4. Prepare the postfix main config file:

    sudo vim /etc/postfix/main.cf

  5. Add/update these lines

  • relayhost=smtp.gmail.com:587
  • smtp_sasl_auth_enable=yes
  • smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
  • smtp_use_tls=yes
  • smtp_tls_security_level=encrypt
  • tls_random_source=dev:/dev/urandom
  • smtp_sasl_security_options = noanonymous
  • smtp_always_send_ehlo = yes
  • smtp_sasl_mechanism_filter = plain
  1. Stop/Start the service

    sudo postfix stop && sudo postfix start

  2. Check the queue for any errors

    mailq

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