Transactional Email

Ah what a nightmare! Inevitably we’ll want some bit of software to react and send off a pearl of wisdom in the form of an email message. Naively perhaps, a bit idealistically, I would like to see that email lands in the recipients inbox.

Bliss that would be to do it consistently and reliably.

Myths or legends get started from who knows when by who knows whom and has a tendency to stick around longer than it should. Tell me if you fell for this old wives’ tale:

“For an application to send off an email, just send it through the smtp server.”

Lets see how that goes:

1. Hey are you an smtp server. Wake up, I want to send an email;

2. Oh hello! Here’s all the crap I support most of which you can’t be sure is supported by all smtp servers and the other half is completely useless. But one thing is guaranteed, it’s all outdated;

3. Sure whatever. Is that liquor on your breathe. Anyway, here is the email to send.

Those numbers aren’t an all too familiar unfixable WordPress formatting flaw, it’s all the back and forth communication between a healthy bit of code and a smtp server. Which takes time. Up to 5 seconds, instead of instantly done.

After all this back and forth, don’t even know whether the email was sent successful or not. Went through the host bureaucracy, the kind that loves receiving forms and whose idea of communication is sending lengthy misleading threats, design smtp… And we are left with the worry that our message is destined for the trash folder or marked as spam – if it even gets delivered.

Side-step the bureaucrat?

For most of us, smtp is our only option.

Forward in time to the 21st century, hopefully everyone has given up on things like: wood gas engines, paper currencies maintaining their purchasing power, and sending email directly to a smtp server. We expect the services we use to be competitive and feature rich. Getting started; painless and quick. And most importantly “reliable.”

“Transactional email” takes the place of the nightmare laid out above. The process is simplified down to sending one request (using curl). With actionable feedback. Lets ignore all the great features for another article, there must be a catch.

Setting up Postmark (transactional email)

The most important reason to go with transactional email is having the piece of mind knowing email communication will arrive reliably, end up in the recipient’s inbox, and happen near instantaneously.


Let’s start by going to and setting up an account. You’re asked to give a name to a “server” and it makes a big show of lots of stuff being configured. Then choose a sender (from) email address that your application will be using when sending emails. A confirmation email is sent. You click on the url within the email. Confirming you are the proud owner of that email address. Pretty standard stuff so far.

Next comes the shocker. Have to make two additions to your site’s dns settings. And only way those changes will happen is if you ask your web host really nicely, and when that fails, never hurts if your web host is a drinking buddy.

Asking web hosts

After explaining the two lines that need to be added to the site’s DNS, I got served a dish of reality:

Servage (Germany web host)

Kindly note that it is not possible to add customized TXT records at Servage. But you can add SPF/TXT records for the hotmail and google by going through the below steps:

Control Panel>> Domains>> DNS settings >> SPF

So dead end there. What Servage supports would be good enough to send or authenticated email through a smtp server. Besides being slow and unreliable, sending from a web email address leaves recipients with the feeling that they are dealing with a bunch of amateurs.

First Choice Internet (Tokyo, Japan)
2012 Apr 4th. Day 1
good to hear from you.

sure, I can make these 2 changes for you.

2012 Apr 8th Day 5
1) txt record for [domain name] – v=spf1 a mx ~all
2) pm_domainkey.[domain name] – IP: (that is the mail server)
3) txt record for pm_domainkey.[domain name] – k=rsa;p=M……..

Could you please check if this is correct and if it is working?

At this point, the keys to the postmark account were handed over, so the web host has a chance at determining whether the changes were successful or not.

2012 Apr 10th Day 7
o-medetou! Should be working now.

Let me know if you should still encounter problems.

So one full week later, the dns changes were finished. Would have been quicker to give over the keys to the postmark account immediately after the web host agrees to make the changes. Lesson hopefully learned.

Afterwards — Bernd Plagge, First Choice Internet

we have been using spf for many years – although in a non-enforcing
way. The required spf record was just a variation of what we put in by

The dkim key is just another record. When I first put it in I made a
copy mistake. Then I had to enter it manually into our DNS database
because the system didn’t like the ‘_’ in the ‘pm._domainkey’
subdomain. But that can be amended.

So, in all it was straightforward.
It is probably a bit too much to expect the average customer to provide
a valid DKIM key. Therefore it makes only sense to offer it to
everybody if we calculate the dkim keys as well.

So warn your web host about the underscore might cause a minor inconvenience.

Code libraries

List of PHP5 libraries, wordpress plug-in, drupal module, magneto extension, and many many more can be found here:

Choose to implement this library for PHP5

Any implementation snafus not covered? Let us know about your horror stories in the comment section.

  1. Is your site using smtp or transactional email?

  2. What transactional email provider did you choose?

  3. What features attracted you to make that choice?