Sending Emails From Local With Postfix and MAMP

[vc_row][vc_column][vc_column_text]If you’re anything like me, you love to work locally building websites without relying on a live server, but this can present some drawbacks such as limiting the full functionality of your site, specifically, the ability to test outgoing emails.  In this post I will show you how to take your development even further and without bounds by enabling the ability to send emails from local with Postfix.[/vc_column_text][vc_column_text]I use MAMP Pro which comes packaged with postfix, however I needed some additional tweaks to get it going smoothly.  I tried many different ways to make postfix work out of the box with MAMP, but alas I was unsuccessful.  A major bummer, because has a “lazy developer” I like the easy straightforward approach as much as the next dev.


 Step 1. Setting up a working Postfix MAMP configuration

[vc_column_text]These instructions are working for me on OS High Sierra with MAMP version 4.4.1

Open the terminal and enter the following command

$open /var/log/mail.log

This will open the mail log console where you can follow along for warnings and errors.

Open the file /etc/postfix/ in your favorite editor

$open /etc/postfix/

  • Add the following lines at the bottom of the file.

relayhost = []:587
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_mechanism_filter = plain
inet_protocols = ipv4
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_tls_security_level = encrypt
tls_random_source = dev:/dev/urandom

Step 2. Create then edit the sasl_passwd file to allow authentication with your Google Account

[vc_column_text]Enter this command in terminal:

$sudo vi /etc/postfix/sasl_passwd


Add the following lines

[]:587 [email protected]:yourpassword[/vc_column_text]

Step 3.  Enter the following commands to restart postfix

[vc_column_text]$sudo chmod 600 /etc/postfix/sasl_passwd
$sudo postmap /etc/postfix/sasl_passwd
$sudo launchctl stop org.postfix.master
$sudo launchctl start org.postfix.master
$sudo postfix upgrade-configuration

Next, reload Postfix.
$sudo postfix reload
$sudo postfix flush

Test that the configuration is working

$date | mail -s testing [email protected][/vc_column_text]

Step 4. Bask in the glory of your accomplishment.

happy Okoye[/vc_column][/vc_row]

4 thoughts on “Sending Emails From Local With Postfix and MAMP

  1. If you are just testing email under MAMP try using ToolHeap Mail tool: Test Mail Server Tool. It will save you a lot of headaches. George Campbell

Leave a Reply

Your email address will not be published. Required fields are marked *