Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Setup SENDMAIL on Mac OSX Yosemite

SENDMAIL on MAC OSX Yosemite

http://www.garron.me/en/mac/postfix-relay-gmail-mac-os-x-local-smtp.html

  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

  6. Stop/Start the service

    sudo postfix stop && sudo postfix start

  7. Check the queue for any errors

    mailq

@privaloops

This comment has been minimized.

Copy link

commented Aug 24, 2015

simple and works, thx

@welps

This comment has been minimized.

Copy link

commented Apr 10, 2016

This worked great for me too, thanks!

@crowmagnumb

This comment has been minimized.

Copy link

commented Apr 13, 2016

Awesome. Thanks! One small thing. If postfix is not running, which it was not for me, then your shortcut
sudo postfix stop && sudo postfix start
fails to run the second half. So two lines would be suggested here.
sudo postfix stop
sudo postfix start

@lebensterben

This comment has been minimized.

Copy link

commented Mar 6, 2017

@crowmagnumb Your modification works for me and fixed my problem. Thx.

@juwul

This comment has been minimized.

Copy link

commented Nov 9, 2017

Seems like a great guide, but I'm having problems with the TSL configuration and have been trying to for hours now. Anyone getting;
TLS is required, but our TLS engine is unavailable
When using mailq after following above guide?

@giovanigenerali

This comment has been minimized.

Copy link

commented Nov 10, 2017

I'm also having the same problem with the TLS
(TLS is required, but our TLS engine is unavailable)
Anyone have a fix about it? Tks

@giovanigenerali

This comment has been minimized.

Copy link

commented Nov 11, 2017

@juwul I found how to fix here http://www.postfix.org/TLS_README.html#built-in

Enable tls:

sudo postfix tls enable-client

Reload:

sudo postfix reload
@hannesa2

This comment has been minimized.

Copy link

commented Nov 11, 2017

I run into postqueue: fatal: Queue report unavailable - mail system is down
after I run sudo postconf compatibility_level=2 and sudo postfix reload sudo postfix start

mailq is now working

@irojus

This comment has been minimized.

Copy link

commented Apr 23, 2018

If you are using gmail don't forget to enable "Less secure apps" - https://support.google.com/accounts/answer/6010255

@sunilbreddy

This comment has been minimized.

Copy link

commented May 29, 2018

Got below error message. Can someone help?
unknown: fatal: relayhost parameter setting must not contain multiple values: 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

@isaacavery

This comment has been minimized.

Copy link

commented Jun 13, 2018

@sunilbreddy, you need to put each parameter on a separate line. Just replace the space before each parameter with a line break, like so:

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
@thanhnd2812

This comment has been minimized.

Copy link

commented Jul 4, 2018

Thanks! It's working on my end but I have a little issue:

I've set: smtp.gmail.com:587 username@gmail.com:password in sasl_passwd and can send emails and all my emails sender address is username@gmail.com.

I want to replace username@gmail.com by user entered email. How can I get it?

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.