keepcalculator

06 Numbers and Powers

Email APIs Explained: How They Work & When to Use

Card No. 06·32096 · Updated · Standard formula, shown below

Average pace 5.00 min/km
Average speed
12.00 km/h
Result
Finish time
50 min
You entered
Distance
10 km
You entered
You enter
Finish time, Distance
You get
Average pace, Average speed
Rounding
2 dp

Email APIs let software send, receive, and manage emails programmatically, replacing manual SMTP setup with a simple interface. You use them when your app needs to send transactional emails, parse incoming mail, or track delivery without running your own mail server. This article explains the core concepts, real-world use cases, and practical considerations.

Formula

The calculator above works out your average pace and speed for a run or ride. The formula for pace is:

pace (min/km) = total time (min) ÷ distance (km)

Speed is the inverse, expressed in km/h:

speed (km/h) = distance (km) ÷ (total time (min) ÷ 60)

Variables:

  • t – total time in minutes (e.g., 50 min)
  • d – distance in kilometers (e.g., 10 km)
  • pace – minutes per kilometer, the standard running metric
  • speed – kilometers per hour, common for cycling

Worked Example

Using the defaults from the calculator (50 minutes, 10 km):

  1. Pace = 50 ÷ 10 = 5.00 min/km
  2. Speed = 10 ÷ (50 ÷ 60) = 10 ÷ 0.8333 = 12.00 km/h

So a 10 km run in 50 minutes means an average pace of 5 minutes per kilometer, or 12 km/h.

Background: Why Email APIs Exist

Email was designed in the 1980s for person-to-person communication. Sending an email programmatically requires an SMTP server, authentication, handling retries, bounce messages, and formatting. An email API wraps all that into a simple HTTP request: you send a JSON payload, and the provider handles the rest.

Providers like SendGrid, Mailgun, and Amazon SES offer these APIs. They manage infrastructure, deliverability, and analytics. The API itself is just a set of endpoints – typically POST /v3/mail/send for SendGrid or POST /v3/messages for Mailgun – that accept recipient, subject, and body content.

How Email APIs Work

At the core, an email API is an HTTP interface to an SMTP relay. Here’s the flow:

  1. Your application sends an HTTP request to the API endpoint with the email details (from, to, subject, body, attachments).
  2. The provider validates the request, checks your API key, and queues the message.
  3. The provider’s servers send the email via SMTP to the recipient’s mail server, handling retries on temporary failures.
  4. You receive a response with a message ID, which you can use to track delivery events.
  5. Webhooks notify your app about opens, clicks, bounces, and complaints.

Most APIs use REST with JSON, but some also support SMTP credentials for legacy systems. The key difference from direct SMTP is that the API handles authentication, rate limiting, and bounce processing for you.

When to Use an Email API vs. SMTP

Choose an email API when you need any of these:

  • Transactional emails – order confirmations, password resets, receipts. These must be reliable and fast; APIs provide delivery tracking and templates.
  • High volume – sending thousands of emails requires infrastructure that handles queues and throttling; APIs do this out of the box.
  • Deliverability – providers maintain IP reputations, DKIM/SPF alignment, and feedback loops. Doing this yourself on a new server is hard.
  • Inbound parsing – receiving emails and turning them into structured data (e.g., support tickets) is easier with an API that posts parsed content to your webhook.
  • Analytics – open, click, and bounce rates are available via dashboards or APIs, saving you from building tracking pixels.

Direct SMTP is still fine for small internal notifications, low volume, or when you already run a mail server. But for anything customer-facing, an API is usually worth the cost.

Common Problems and Misconceptions

A frequent mistake is assuming email APIs are free. Most have a free tier (e.g., 100–200 emails/day) but charge beyond that. Another is ignoring bounce handling – if you don’t process webhooks, your sender reputation drops.

People also confuse “email API� with “email service.� The API is just the interface; the service includes the infrastructure. You can use the API without buying a domain, but you should verify your sending domain to avoid spam filters.

One misconception: email APIs guarantee delivery. They don’t – they guarantee sending. The recipient’s server may reject the mail, or it may land in spam. That’s why tracking bounces and complaints matters.

Comparing Popular Email API Providers

Major providers differ in pricing, deliverability, and features:

  • SendGrid – strong template engine, good analytics, free tier of 100 emails/day.
  • Mailgun – excellent inbound parsing, flexible routing, free tier of 100 emails/day.
  • Amazon SES – cheapest per email (around $0.10 per 1,000), but requires more setup and has no free tier (except 3,000 free per month for a year).
  • Postmark – focused on transactional email, fast, but no free tier (trial only).
  • Mailjet – good for marketing and transactional, free tier of 200 emails/day.

All support REST APIs, webhooks, and SMTP fallback. The choice often comes down to volume, budget, and whether you need inbound parsing.

Costs and Pricing Models

Email API pricing is usually per thousand emails, with volume discounts. Typical ranges:

  • Free tier: 100–200 emails/day for small apps.
  • Paid plans: $10–$20 per month for 10,000–50,000 emails.
  • Volume pricing: $0.10–$0.50 per 1,000 emails beyond the included quota.

Some providers charge extra for features like dedicated IPs, additional domains, or advanced analytics. Always check the free tier limits – they reset daily, not monthly, so you can’t accumulate unused quota.

Hidden costs include overage fees and the time to integrate webhooks. For a small app, the free tier is often enough; for a startup, a paid plan is a business expense.

Safety, Security, and Deliverability

Email APIs handle security differently from direct SMTP:

  • Authentication – API keys are sent in headers, not in the email. Keep them secret; leak them and anyone can send as you.
  • Encryption – HTTPS for the API call, and TLS for SMTP delivery. Most providers encrypt by default.
  • SPF/DKIM/DMARC – providers help you set these up to verify your domain. Without them, emails are more likely to be marked as spam.
  • Data privacy – email content passes through the provider’s servers. For sensitive data, check their compliance (GDPR, HIPAA) – not all providers are HIPAA-compliant.

Deliverability is also a safety issue: if your domain gets blacklisted, all your emails fail. Use a dedicated IP if you send high volume, and monitor bounce rates. Never buy email lists – that leads to spam complaints and blacklisting.

Alternatives to Email APIs

If an API isn’t right, consider:

  • SMTP relay – use your own mail server or a relay like your ISP. Cheaper but you handle everything.
  • Email client libraries – like Nodemailer or PHPMailer, which send via SMTP. They’re not APIs but can be used with any SMTP server.
  • Webhooks only – if you only need to receive emails, use a service like Mailgun’s inbound routing, which is an API but you don’t send.
  • In-house infrastructure – run your own Postfix server. This is complex and rarely worth it for a business app.

For most developers, an email API is the right balance of cost, reliability, and ease.

Frequently Asked Questions

Do I need my own domain to use an email API?

Yes, you should verify a domain you own. Providers let you send from their shared domain during testing, but emails will likely land in spam. Verifying your domain (adding DNS records) is free and takes minutes.

Can I send attachments with an email API?

Yes, most APIs support attachments by base64-encoding the file in the request. There’s usually a size limit (e.g., 25 MB). For larger files, upload to cloud storage and include a link.

How do I know if an email was delivered?

Use webhooks. Providers send events like delivered, opened, clicked, and bounced to your endpoint. You can also poll the API for message status, but webhooks are more efficient.

What’s the difference between transactional and marketing emails?

Transactional emails are triggered by user actions (order confirmation, password reset) and must be sent immediately. Marketing emails are bulk campaigns. Most APIs treat them differently – transactional emails have higher deliverability because they’re expected.

Is it cheaper to run my own SMTP server?

For very low volume (a few dozen a day), yes – a VPS costs a few dollars a month. But you pay in time: maintaining IP reputation, handling bounces, and monitoring blacklists. For any serious app, an API’s cost is worth the reliability.

Can I use an email API for a newsletter?

Yes, but most providers separate transactional and marketing. For newsletters, you need list management and unsubscribe handling, which some APIs offer. Dedicated marketing platforms like Mailchimp may be easier if you don’t want to code.

Related

Formula used
in t | Finish time | min | 50 | 0
in d | Distance | km | 10 | 0 | 100000
out pace | Average pace | min/km | t / d | 2
out speed | Average speed | km/h | d / (t / 60) | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →