Send and Receive with These Four Email APIs

So you need to send emails. Pretty simple right? Not so fast. It doesn’t matter how easy your language or framework makes sending emails, if you try to do it on your own be prepared to configure mail servers, setup Spam-related DNS entries, and still wonder if mail is actually being delivered. And your applications needs to process incoming email? Back to the config files, piping mail to your script - or just end up polling a POP or IMAP box. That’s what I had to do, back in the day. Fortunately, like so many things today, there’s an API for that. Actually there are a few.

Here’s an overview of four transactional email APIs that offer incoming and outgoing email:

(If I’ve missed one, let me know.)


If you’re integrating an API into your existing system, the ability to send mail using SMTP may make that initial process pretty painless. All but EmailYak support sending via SMTP, with various implementations.

For Postmark, your API Key is the user and password, MailGun assigns a set of SMTP credentials for your account, and SendGrid uses the login credentails for your account (the same used to log into the admin interface). Changing that behavior looks to be something SendGrid is planning to change.

Send API

EmailYak and Postmark provide an API endpoint accepting a POST with the JSON representation of an email message. Property names are different between the APIs; however, the JSON structure is relatively similar.

Mailgun and SendGrid accept a more HTTP like request, with properties sent as form parameters. SendGrid accepts a GET or a POST (being a self-described non-RESTful API), while Mailgun only accepts POST. MailGun also allows you to POST a full MIME encoded message.

Receive API

All APIs can be configured to deliver email to a web URL. Both Postmark and EmailYak send a JSON body representing the email message as a POST to your web URL.

Just like the Send API, SendGrid and Mailgun deliver the email as a set of HTTP form parameters, with any attachments sent as a file upload.

With EmailYak, the callback URL can be configured to send a notification containing the message id and a few other parameters, instead of the full email data. EmailYak will also store incoming messages which can be accessed using the API.

For similar purposes MailGun allows mailboxes to be created, which can be accessed using standard POP or IMAP interfaces. Mailgun also has rich filter and routing support, allowing emails to be sent to various URLs and mailboxes depending on mail headers.

Tracking & Other Features

SendGrid and Mailgun provide tracking for unsubscribes, opens, and clicks, along other features. Postmark provides bounce tracking. Mailgun allows messages to be scheduled. Postmark allows your email to be segmented into ‘servers’. Each server has its own API key, and incoming email address. Mailgun and SendGrid also support email templates. SendGrid allows you to pass additional commands through SMTP headers.

Hopefully this overview has given you an idea of which API fits your needs best. Any of the four should make life easier than dealing with server configuration and incoming messages directly.

Be sure to read the next Email article: 199 Email APIs: SendGrid, Google Gmail and Yahoo Mail


Comments (10)

Go with MailGun I upgraded to them cause sendgrid couldn't handle the traffic. Mailgun has great customer service best i've ever experienced.


Too bad you didn't integrate Mailjet in your blog post. Another player also coming from France is Critsend. Have a look, it worths it! Especially for Mailjet we really try to offer the best value possible.

Here's a nice overview

Concerning Alex's remark, please note that our algorithm detects the transactional emails and routes them via a special path. I mean, it's not because a company routes marketing + transactional emails that it chooses to mix everything.

Don't hesitate if you got questions.

I restricted the group to APIs that send and receive. As far as I know SES doesn't parse incoming mail. I believe SES allows you to send via API or SMTP, so for those purposes it should be comparable to the APIs listed here.

One of the important distinctions with Postmark is optimized for and only allows the sending transactional emails. This makes our delivery rates for transactional emails much higher and more reliable than mixing transactional and bulk email from the same infrastructure.

Our pay-as-you-go pricing structure also makes sure that all of our customers have access to the same high-quality service, instead of needing to pay even more for services in order to get better than commodity email delivery service.

[...] I choose MailChimp because it provides all of this nice features and has a good reputation. If you are looking for more informations about providers, you can read this article [...]

[...] Mobile application I choose MailChimp because it provides all of this nice features and has a good reputation. If you are looking for more informations about providers, you can read this article [...]

Do either Mailjet or Critsend support receiving mail via the API/webhooks? This post only inluded APIs that both send and receive - or it would have included many more (for example, Amazon SES).

[...] external thing that needs to be done. A good amount of the time there is – if you need to send email, push real-time updates, offload data storage, deliver faxes, even hire someone like me, there [...]

An interesting discussion is worth comment. I do think that you

need to publish more about this topic, it might not be a taboo subject but generally folks don't talk about such subjects. To the next! All the best!!