Introducing the Gnaritas Amazon SES WordPress Plugin

amazon-ses-300If your website sends significant amounts of email to its users —like notifications about new content or products— and you’re still sending email using sendmail or a local SMTP server, you’ve probably experienced emails being flagged as spam or delayed email delivery. Your hosting provider might also impose sending quotas, and they may shut down your site completely if they notice your server suddenly spewing out thousands of emails. Sooner or later, you’ll need to start using a “legit” SMTP server —one that receiving hosts can verify as authorized to send email for your website’s domain— to ensure reliable email delivery.

Toward this end, we’ve had success using Amazon Web Services Simple Email Service (SES). Email sent through SES from a verified domain or address is delivered instantly and almost never gets flagged as spam. However, this reliability comes at a price. Amazon vigilantly protects their reputation. They require you to have a procedure in place for handling bounces and complaints, and they will get after you if you persistently send email to bad addresses. By default, SES sends bounce and complaint notifications to the sender’s address, but manually handling bounces and complaints is not feasible for the volume of email you’d have to be sending to warrant using SES.

Fortunately, you can automate bounce and complaint handling using another AWS service: the Simple Notification Service (SNS). First, you create an SNS “topic” to which SES bounce and complaint notifications are “published”. Then, you “subscribe” a URL endpoint on your website to receive SNS notifications published to that topic. When your URL endpoint gets an SNS notification, your code can take appropriate action to remove the bad address from your mailing list.

We’ve decided to share the code we’ve written to do this for some of our clients’ WordPress sites with the WordPress community. The Gnaritas Amazon SES WordPress plugin sends WordPress site email through SES, handles bounces and complaints using SNS, and suppresses email to bounced or complained addresses. It also logs bounce and complaint notifications in WordPress’ MySQL database which you can export in CSV format.

Check it out in the WordPress plugin repository!