Why email?

Many modern applications rely on automated email sending and receiving for communication with users. Althought real-time chat and messaging bots have become more popular of late, email still dominates.

Emails are sent for a variety of reasons: for user activity notifications, weekly updates, or prompts for payment. They may also be received by applications to handle inquires or support request.

If you need to integrate emails into your application there are many ways to do so. This post will concentrate on simple and easy ways to send and receive emails using NodeJS as a demonstration.

Node has an abundance of third-party libraries and great serverless support meaning it's easy to get started but you can use any language you like.

Requirements

The sending of email relies on the SMTP protocol. It isn't necessary to set up a mail server in 2019 and should be avoided if possible. It's a complicated process best left to dedicated mail servers or SAAS providers. Luckily there are many of these to choose from, and most have excellent API or SDK support.

As there are many email sending services out there let's break them down into three main categories:

  • Templated mail services
  • Mail as infrastructure
  • SMTP relay

We'll cover each category now and then talk about how test email workflows.

Templated mail services

Templated mail services typically offer feature-rich email template design and management tools. The APIs they offer ask for a template id, a list of personalizations (such as the name, date etc) and a recipient. The appearance of the email and compliance with email regulations for given markets are handled through the services' UI.

templating

Templated mail services will often handle user unsubscription, spam avoidance and analytics. For most use-cases templated mail services offer a good balance of convenience and features. The downsides are that they can be expensive and limiting for some use cases.

Here are some common services and their pricing models. Limits and pricing are based on the entry-level plans listed on their websites.

Icon Name Limits Pricing
SendGrid Send 40k per month $14.95 per month
MailJet Send 30k per month $8.69 per month
MailGun Send 40k per month $15 per month
Mandrill (MailChimp) Send 50k per month $40 per month
SendInBlue Send 40k per month $19 per month

Mail as infrastructure

If you want a bit more control over your email or you want higher volumes and lower costs using the email services of a major cloud provider is a good way to go. However be aware that managing of DNS and DKIM records may be up to you. Due to it's huge popularity AWS SES is a clear winner in this category.

AWS SES