Monday, December 15, 2014

MAMP PRO: Postfix - The Ultimate Guide

MAMP PRO only uses Postfix from Mac OS X to implement basic mail-sending capabilities. It was designed to help developers to check if their mail scripts are working correctly, to see if all the information that is supposed to be in a mail, is really there, to check the layout and so on. It was never intended to use Postfix as a full-fledged email server replacement. Please keep that in mind.

A minimal Postfix setup is simple. We use Googles Gmail service as an example to demonstrate the workings of Postfix.

In the Postfix section of MAMP PRO please set the domain of outgoing emails to "". Leave the Smart Host checkbox unchecked.

Click the Button "Use this data". In Postfix' log file you will see something like

Dec 12 09:10:48 Tonne postfix/master[31865]: daemon started -- version 2.9.4, configuration /etc/postfix

The log file is located at /var/log/mail.log and can be viewed with

In MAMP PRO, create a host (let's say you call it 'postman') and assign it a document root folder.

In a text editor create a PHP script, a basic mail-sending PHP script would look like:

Please replace '' and '' with working Gmail addresses. Save the script to the document root folder of 'postman'.

Make sure the servers of MAMP PRO are running and click on the right arrow located next to the field "Server name" in the General section of the Hosts view. Your web browser should open and show the message "Testing Postfix...".

In /var/log/mail.log new entries will appear, similar to

The most important information is "status=sent". This means Postfix has handed the message over to Gmail which has accepted it. The last line indicates that Postfix has removed the message from its local queue, Postfix has done its work!

If, and where to, Gmail delivers the message is out of the hands of Postfix now. Please check your spam folder if the message does not show up in your inbox. Make sure you are looking in the correct spam folder, on Gmails webpage it's hidden behind "More" in the folder hierarchy on the left side.

If you need more sophisticated email capabilities you might want to use a Smart Host. In this case, please contact your email provider for the correct settings. Typically, free accounts do not have smart host capabilities.