MAMP Pro makes it very easy to set up a PHP development environment. It even makes configuring your Postfix mail server configured most of the way. If you are using Postfix as a smart host to send mail through your ISP or your business mail server and your mac username (shortname) is not the same as the username part of your email address then you have to set up the correct sender address in your Postfix configuration. Here is how you do it.

Setting The Correct Sender Address In Postfix

My mac (work computer) is set up with usernames in the format of first inital, last name (lblue). We use Rackspace Email for our company email and our email addresses are set up as just FirstName@domain.com (Lee@domain.com). So, the problem with the default Postfix configuration is that it attempts to send mail based on the username on my mac. So when postfix attempts to send mail from lblue@domain.com our Rackspace Email server complains with a “Sender address rejected” error message. Fortunately, the solution is pretty easy.

Step 1: Edit your /etc/postfix/main.cf and add following line to your configuration.

sender_canonical_maps = hash:/etc/postfix/sender_canonical

Step 2: Create the sender canonical file /etc/postfix/sender_canonical and set up the username / email address associations


lblue    Lee@domain.com

Step 3: Run postmap on your new sender canonical file

sudo postmap /etc/postfix/sender_canonical

Step 4: Reload Postfix

sudo postfix reload