Ops, Entrepreneurism, Tools, and Thoughts.


Recently the team was working on some stuff in EC2. This is a bit new for us so we’re figuring many things out as we go. One thing work sharing is integrating a PHP web app running in EC2 to Amazon’s Simple Email Service. Following the guides gets you 90% of the way but the last mile had a snag. Full disclosure, none of us is email experts.

We implemented the PHP - Postfix - Stunnel - SES approach advocated by AWS. The older option used perl and worked for us. However, we did want to go after the best practice approach and it’s outlined with the postfix setup and the stunnel setup.

The snag we hit was as follows: using the perl tools we could queue an email in SES. Note, when in sandbox mode you can only send to and from the verified email addresses. Do yourself a solid and setup two addresses. Otherwise reading the mail.log file will blow your mind. When we tried to queue an email from our PHP app through postfix across the stunnel to SES the to and from fields were, in a word, effed up. Turns out setting the MyDestination parameter in the main.cf file of the postfix config was the culprit. Also, in our PHP.ini file we ensure that we were starting sendmail with the suggested unix flags but that’s a red herring for this issue. Our solution was to unset the MyDestination parm and pow. Up and running. We think. Here’s to a great push by @ericchernuka, @dannydotellis, and @swinglinetrade to solve a stinker.