Avoid Vendor Lock-in When Sending Emails by Using SMTP

Email delivery providers such as Mandrill, Mailgun, SendGrid, AWS SES etc. all provide proprietary APIs and SDKs to send email over their service. These APIs are different from one email provider to the next. However all these services also allow you to send email via the industry-standard SMTP.

All email delivery providers encourage you to use their own API. Sometimes they don't really indicate strongly that there is any alternative to using their API. For example the current SendGrid homepage has a big box about the "SendGrid API"; I don't see anything about SMTP on their homepage.

When working with business customers to implement their requirements in software, often they will inform me which email provider I should use to implement their software. Surprisingly they all have a very strong opinion that I should use the API provided by the provider as opposed to using SMTP. I always push back, in their own interests.

One company I was working for sent a large number of emails to people to inform them of the existence of their product. I don't want to attribute blame, but let's say it's possible the people who received these unsolicited emails understood the need to receive those emails less than the company had envisaged. We kept on getting banned from email providers, and having to move to another one. Because I insisted on using SMTP it was a simple matter changing a config file to change email providers. (Of course we also had to sign up to the new email provider, and enter some DNS settings, but we'd also have had to do that if we'd used their proprietary APIs. The difference was, by using SMTP, that was all we had to do.)

Even if you don't send emails where your and the recipient's opinion of the email's usefulness might diverge, pricing can change and needs may change, so it's always good to have the freedom change from one provider to another easily. It's always good not to be dependent on your vendors any more than necessary.

Standard email software in any programming language is designed to send SMTP (for example JavaMail). The email delivery providers claim that the their proprietary API can be "easily" integrated with your software. But there's bound to be some software which is incompatible. Using SMTP you have a much greater choice of application software you can use to send your emails with, or integrate with your custom-developed software.

There's a reason why email providers heavily promote their own APIs over SMTP. They don't want you to have the flexibility to easily change to their competitor. This is exactly the opposite of your goal. They are literally working against your interest. Don't let them fool you. Use standard SMTP rather than their proprietary solutions. Maintain your power over them.

P.S. I recently created a nerdy privacy-respecting tool called When Will I Run Out Of Money? It's available for free if you want to check it out.

This article is © Adrian Smith.
It was originally published on 24 Jul 2018
More on: Software Architecture