Sending Reliable Email with Postmark
Reliable email delivery is important to your business: your website probably has a contact form for hiring inquiries; your web application(s) rely on email for interaction with your clients, heck, you might even rely on your server to send email for e-commerce transactions. If those emails do not reliably reach you or your (prospective) customers, you're, quite literally, losing business.
After a couple of years of struggling with email I have finally found the solution to make sure each of my emails reaches the inbox of its recipient and I'm about to share it with you.
Note: this is not a paid review. In fact, since Postmark doesn't have an affiliate program, it's not even a post with some affiliate links. It's just me solving a problem for myself that I hope you will now be able to solve too.
The problem: email not reaching its recipient
I wrote about email reliability before, but let's be honest: getting all the web servers we use for sites to send email reliably is a pain. You need to setup SPF records, preferably set up DKIM too and make sure that your web servers do not get blacklisted. One of my servers, for which I had set up SPF, for some stupid reason got blacklisted a couple of weeks ago, resulting in a couple of website review emails not reaching my customers. I hated that so much that I started looking for another solution.
On this site, I had switched from Gravity Forms to Wufoo a while back. Wufoo is another awesome web forms service, with the at that time "added value" that Wufoo would take care of the email sending for me. My main gripe with using Wufoo was that I really wanted my forms and the entries of my forms in my site's install, not somewhere else. On top of that, Gravity Forms gives me a bit more programming flexibility, so I wanted it back. So, I had two email problems and started to look for a solution to both at the same time.
Postmark: reliable email
I found that solution in Postmark, which handles transactional email through a set of reasonably simple but reliable API's. Using this pre-built library, I was able to replace the email sending in my website review application for Postmark within about 10 minutes.
Yes, Postmark costs a bit of money, but if you consider that at $1,50 per thousand emails, you run a lot smaller chance of losing customers over email not reaching its destination, it seems to me that that's money well-spent.
It took me a bit longer to code a WordPress plugin that I liked for Postmark. There are a couple of WordPress plugins listed on the Postmark site, but all of them relied on CURL, which I don't have on every server I run WordPress on, and they all ignored some of the headers that plugins like Gravity Forms passed along. So I used the same pre-built library, but adapted it this time to use the WordPress HTTP libraries and added a wrapper to more reliably pick up all the headers that might get added by plugins.
The result is a plugin that is pretty easy to use, my own Postmark Email for WordPress Plugin.
WordPress email sending tips
By default, WordPress sends email from wordpress@example.com, where example.com is your domain. In 99% of cases this is a non-existing email address. More and more people, including Postmark, are saying that using a non-existent email to send your email from is not a good idea. I agree. So I created wordpress@yoast.com, which gets filtered into a tag in my email.
The great thing about actually creating that email address is that you can also assign a gravatar to it. This means that when people use email clients like Sparrow, or other email clients that support Gravatar, they'll see a nice avatar image for your email too. In my case, I made sure that image was the Yoast logo.
Go forth and email!
And please do let me know your comments about both Postmark, the plugin and your tips for reliable email in the comments!




by Keith Malone on 5 December, 2011 at 12:27
EXACTLY the solution that I was looking for Joost! I look forward to implementing. Thanks very much for sharing.
by Niels on 5 December, 2011 at 15:14
I once compared several transactional e-mail services for usage with Magento.
Several services which offer almost the same are available for transactional e-mail. Postmark, Sendgrid, Critsend and Socketlabs. The cheapest start at $0.50/1k e-mails. The most expensive is Postmark with $1.5/1k e-mails. I don't know why Postmark is 200% more expensive, the service they offer doesn't seem to be better and I haven't found any argument why their deliverability would be better.
Since the beginning of this year, Amazon offers Simple E-mail Service (SES). Price $0.1/1k e-mails. With this service you can only send e-mails, no statistics are included. Luckily Mailchimp offers an app for Amazon SES to produce statistics. Price: Free.
If your company uses Google Apps, you can just use the Google SMTP server. Price: Free.
My guestimation on deliverability:
1. Services like Postmark, Sendgrid, Critsend and Socketlabs
2. Amazon SES
3. Google's e-mail services
4. Your own e-mail server
Conclusion
Do not run your own e-mail server. Maintaining an e-mail server is expensive. You won't be able to compete on reliability and cost with the services mentioned above.
If reliability is of upmost importance, use a services like Postmark, Sendgrid, Critsend or Socketlabs. Just pick the one which fits your needs and budget.
Do you already use Google apps? Just use the Google servers.
Do you want pretty good deliverability and do you send a lot of transactional e-mails? Use Amazon SES. It is cheap and they are continuously working on deliverability.
by Joost de Valk on 5 December, 2011 at 15:20
Hi Niels,
I've seen SendGrid too and they actually deprecated their normal API in favor of an SMTP one that I didn't like one bit. Google's SMTP services actually come with a limit that some people might not like, see this:
http://www.google.com/support/forum/p/Google%20Apps/thread?tid=57aaeb107af8ce94&hl=en
For me, the ease of use of setting up SPF, DKIM and "servers" with postmark was what triggered me to use them.
by Niels on 5 December, 2011 at 15:40
I like Critsend. They offer an API and SMTP. Feature rich service and they can send messages under 2 minutes which is really important for "Thank you for your order" e-mails. They don't offer a Magento plugin. Development of the plugin is not expensive, but not worthwhile because a Postmark Magento extension is available.
Do you know how fast Postmark is?
by Joost de Valk on 5 December, 2011 at 15:41
It seems to be instant, as in, emails go out within a few seconds. I've never had more than 10 seconds delay.
by Brian O'Neill on 5 December, 2011 at 21:37
I have been using http://elasticemail.com/ for the past few months and they have been excellent. They cost only $1 per 1000.
They also offer newletter sending for the same price a lot cheaper than mailchimp etc check them out.
by Carsten on 7 December, 2011 at 14:14
Hi Joost
Thank you for this info, and for making the plugin for WordPress. I will be testing this on one of my sites shortly, and probably implement it permanently, it sounds great.
I have a question:
Would it be possible to have a WordPress instalation(site) where some e-mails get sent using the "standart" WordPress method, and other e-mails sent using Postmark?
(I know that it is a special situation, but I would really like to do that on one site)
Thanks,
Carsten
by Joost de Valk on 11 December, 2011 at 09:46
Not the way I currently built it but I have an idea for WP core that would allow for that quite easily :)
by Cor van Noorloos on 10 December, 2011 at 21:39
Hi Joost,
It seems the plugin hosted here isn't the same as over at wordpress.org.
Also, having the WP debug mode enabled, it's giving me this error
Notice: Undefined index: postmark_hidden in /home/mydomain/public_html/wp-content/plugins/postmark/wp-postmark.php on line 121It's a great plugin though. Thumbs up!
by Cor van Noorloos on 10 December, 2011 at 21:47
As a side-note, (I'm using a newly created e-mail address for commenting here) may I ask which comment subscription plugin you're currently using here at Yoast.com?
by Cor van Noorloos on 10 December, 2011 at 22:05
I just realized this isn't an error caused by your plugin, but from another named the same from the WordPress repository. You may wish to check this article for that: http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-update-checks/
Now noticing this, your plugin is outputting this error
on activation
Plugin could not be activated because it triggered a fatal error.Fatal error: Cannot redeclare wp_mail() (previously declared in /home/mydomain/public_html/wp-includes/pluggable.php:203) in /home/mydomain/public_html/wp-content/plugins/postmark/postmark.php on line 239
by Joost de Valk on 11 December, 2011 at 09:44
Yeah it has the same name, I noticed, will be going to wordpress.org under another name. Of course I already know that article by Mark Jaquith but one should never, ever, do that in a plugin that is released to the public...
As for the bug: i run it from my mu-plugins folder myself, which is why I didn't notice the issue, will see if I can find a workaround.
by Terence on 11 December, 2011 at 01:44
I seem to recollect, although I might be wrong, but I thought you were a big fan of MailChimp not long ago. What happened to change your opinion?
by Joost de Valk on 11 December, 2011 at 09:45
Hi Terence, I still am!! MailChimp is the awesome :) These serve different purposes though: MailChimp doesn't do this kind of transactional email well as they want an opt-in all the time, whereas Postmarkapp doesn't allow newsletter mailings.
by Terence on 11 December, 2011 at 16:41
Well, I got an email prompt that you'd answered my question here and it came via Postmark, but I am not familiar with this definition of "transactional" email, as distinct from what MailChimp does, so I guess I better go and look it up.
by Joost de Valk on 11 December, 2011 at 16:58
A mailing list / newsletter is the kind of thing MailChimp does, "transactional" email is anything related to how apps work, like for example, the subscribe to comments email you got here, or even more appropriate: an order confirmation email from a webshop.
by Joost de Valk on 11 December, 2011 at 16:59
Also, transactional email is 1 to 1, or 1 to a few, where a newsletter is usually 1 to many :)
by Terence on 11 December, 2011 at 17:58
Do you really think that using Postmark is worth the extra cost over using,say Google apps? And if so, how do you quantify that?
by Joachim Kudish on 11 December, 2011 at 22:56
Just curious, what does your plugin do that the official/approved Postmark plugin doesn't? http://wordpress.org/extend/plugins/postmark-approved-wordpress-plugin/
by Joost de Valk on 11 December, 2011 at 23:01
Just a couple of the things it does better than the approved plugin:
- Use the WordPress HTTP libraries instead of CURL (so it works when CURL isn't available)
- Handle From / CC / BCC headers correctly
- Use SSL (!!!!) and correctly verify the host on the other side
by Joachim Kudish on 11 December, 2011 at 23:03
Great!
Did you consider contributing to the original plugin rather than creating your own? Less fragmentation and better results for end-users that way, no? :)
by Joost de Valk on 11 December, 2011 at 23:04
To be honest I only found the official one after having written my own and it's so completely different that there's no real use.
by Joachim Kudish on 11 December, 2011 at 23:07
That's too bad. Will have to read the code of both to decide which one I use next time I use Postmark :)
by Joost de Valk on 11 December, 2011 at 23:08
Not at all, just trust me ;)
by Joost de Valk on 12 December, 2011 at 00:24
The plugin is live on the WordPress repository and now properly activates as well.
Download version 0.3 straight from the plugin page here on Yoast or on WordPress.org.