OSX comes with Postfix pre-installed. All that needs to be done is to configure it AND PHP. There are a couple of configuration files involved. Each file that needs to be adjusted is attached to this gist along with the relevant configuration options and settings.
You will start by editing the Postfix config file located at: /private/etc/postfix/main.cf
.
You will then edit your PHP config file (php.ini) which, for me I installed via macports and was thus located at: /opt/local/etc/php56/php.ini
.
These are the two pages that I used to get things working:
After running those steps above, I was able to get Drupal to send out emails from my local environment as I was testing mail functionality in it.
One more thing to note...
I've set up SMTP for Postfix so that I could test emails from any network. Using this "sasl_passwd" method is not necessary if you know the outgoing SMTP server of your ISP and you know that they have an active and un-authenticated SMTP server (like TekSavvy's Outgoing SMTP Mail Server). This didn't work for me because I'm not always working from home - I sometimes visit client offices and work from there. As such, setting up Postfix to send email via authenticated SMTP was the next best option. I have a Gmail account with 2-factor authentication which is great - it means that when I stored the password in the sasl_passwd
file, I didn't need to worry TOO much about it because, having 2-factor auth enabled for Gmail meant that I could generate an "App password" and use that. So... keep that in mind!