Sending Reliable Email with Postmark

Reliable Email DeliveryReliable 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!

Tags: ,


Yoast.com runs on the Genesis Framework

Genesis theme frameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides you with the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Read our Genesis review or get Genesis now!

25 Responses

  1. Keith MaloneBy Keith Malone on 5 December, 2011

    EXACTLY the solution that I was looking for Joost! I look forward to implementing. Thanks very much for sharing.

  2. NielsBy Niels on 5 December, 2011

    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.

  3. NielsBy Niels on 5 December, 2011

    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?

    • Joost de ValkBy Joost de Valk on 5 December, 2011

      It seems to be instant, as in, emails go out within a few seconds. I’ve never had more than 10 seconds delay.

  4. Brian O'NeillBy Brian O'Neill on 5 December, 2011

    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.

  5. CarstenBy Carsten on 7 December, 2011

    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

    • Joost de ValkBy Joost de Valk on 11 December, 2011

      Not the way I currently built it but I have an idea for WP core that would allow for that quite easily :)

  6. Cor van NoorloosBy Cor van Noorloos on 10 December, 2011

    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 121

    It’s a great plugin though. Thumbs up!

    • Cor van NoorloosBy Cor van Noorloos on 10 December, 2011

      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?

    • Cor van NoorloosBy Cor van Noorloos on 10 December, 2011

      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

      • Joost de ValkBy Joost de Valk on 11 December, 2011

        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.

  7. TerenceBy Terence on 11 December, 2011

    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?

    • Joost de ValkBy Joost de Valk on 11 December, 2011

      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.

      • TerenceBy Terence on 11 December, 2011

        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.

        • Joost de ValkBy Joost de Valk on 11 December, 2011

          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.

        • Joost de ValkBy Joost de Valk on 11 December, 2011

          Also, transactional email is 1 to 1, or 1 to a few, where a newsletter is usually 1 to many :)

          • TerenceBy Terence on 11 December, 2011

            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?

  8. Joachim KudishBy Joachim Kudish on 11 December, 2011

    Just curious, what does your plugin do that the official/approved Postmark plugin doesn’t? http://wordpress.org/extend/plugins/postmark-approved-wordpress-plugin/

    • Joost de ValkBy Joost de Valk on 11 December, 2011

      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

      • Joachim KudishBy Joachim Kudish on 11 December, 2011

        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? :)

        • Joost de ValkBy Joost de Valk on 11 December, 2011

          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.

          • Joachim KudishBy Joachim Kudish on 11 December, 2011

            That’s too bad. Will have to read the code of both to decide which one I use next time I use Postmark :)

          • Joost de ValkBy Joost de Valk on 11 December, 2011

            Not at all, just trust me ;)

  9. Joost de ValkBy Joost de Valk on 12 December, 2011

    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.