SMTP vs Email API: What’s the Difference?
SMTP vs email API in plain English: what each one is, how they differ, which one Claude Code usually sets up for your SaaS, and what to tell it.
Quick answer
SMTP vs email API comes down to how your project hands emails to an email service. SMTP is the long-standing email standard, a step-by-step exchange using a server address, username and password. An email API sends each email as one secure web request. For a new SaaS built with Claude Code, the API usually fits better.
Last checked: October 2026
On this page
Maybe Claude Code has asked whether your project should send email over SMTP or through an email API, or a tool you use wants "SMTP settings". This guide explains SMTP vs email API in plain English, so you can make the call and get back to building.
What are SMTP and an email API?
Both are ways of passing an email from your project to an email service, which then delivers it. SMTP is the long-standing standard for moving email between servers. An email API does the same handoff as a single web request.
SMTP stands for Simple Mail Transfer Protocol: the shared set of rules email systems use to pass messages to each other. The current standard, RFC 5321 from 2008, describes a step-by-step exchange. The sender connects, says who the email is from, lists who it's for, then sends the message, and the server replies to each step with a three-digit code, such as 250 for "OK". For more background, see our guide to what SMTP is.
An email API (application programming interface: a set of instructions one piece of software can send to another over the web) does the handoff in one go. Your project sends a single request to the email service with the sender, recipient, subject and content. The service replies with an ID it uses to track that email. Resend's send-email API works this way, for example.
Either way, the same email service does the delivery, so both routes need the same basics:
- A secret key. This is an API key: a long, private password that lets your project use the service. With SMTP, many services use it as your password. Resend and SendGrid both do.
- A verified sending domain. Domain verification means adding a few DNS records (settings for your domain) where your domain is registered, to prove you own it.
These are usually transactional emails: automatic, one-to-one messages like welcome emails, password resets and receipts.
How do SMTP and an email API differ in practice?
The main differences are how your project connects, what it gets back and where it can run. For a SaaS sending emails as things happen, an email API is usually the smoother fit. SMTP fits when a tool only offers SMTP settings.
| SMTP | Email API | |
|---|---|---|
| How the handoff works | Connects to the service's mail server, then several back-and-forth steps | One secure web request |
| What you fill in | Server address, port, username and password | A secret key, plus a small piece of sending code Claude Code writes |
| What comes back | A short reply code at each step | A structured reply with an ID for the email |
| Can your host block it? | Some hosts block the usual SMTP ports | Uses the same kind of web connection as your site |
| Extra options per email | Limited, often added through email headers | Depends on the service, such as templates, scheduling and tags |
A port is a numbered entry point on a server, a bit like a door number. SendGrid lists 25, 2525, 587 and 465 for SMTP and typically recommends 587. Resend offers 25, 465, 587, 2465 and 2587.
Ports matter because some hosting companies block them. DigitalOcean blocks ports 25, 465 and 587 on its Droplets (its virtual servers) by default to prevent spam, and recommends using an email service instead. An email API sends over the same kind of secure web connection your site already uses, so SMTP port blocks don't affect it.
Which one does Claude Code usually set up?
For a new SaaS, site or tool, Claude Code will usually set up the email API. Email services lead with their APIs for projects like this, and most publish an SDK (software development kit: a ready-made library for using their API from code). Resend's send-email page shows examples in eight programming languages.
With the API, Claude Code writes a small piece of sending code and stores your secret key in a safe place, such as your hosting settings. Our guide to where to put API keys explains why the key shouldn't sit in your code.
SMTP usually comes up in two situations:
- A tool that only has SMTP settings. Form builders, website platforms and plugins that send email for you often ask for a server address, port, username and password, because they can't run your code.
- A project that already uses SMTP. If it works and you're not hitting port blocks, there may be no reason to switch yet.
SMTP vs email API: what are the pros and cons?
SMTP's biggest strength is that it works almost anywhere. An email API's is that it's built for code you control, with clearer replies and more options.
| Pros | Cons | |
|---|---|---|
| SMTP | Works in any tool with an SMTP settings box. A shared standard, so switching services usually means changing four settings. | Some hosts block the usual ports. Short reply codes. Fewer options, and less debugging detail at some services (Resend doesn't provide SMTP server logs). |
| Email API | One request per email, with an ID to track it. Clear errors. Extras like templates, scheduling and tags, depending on the service. Not affected by SMTP port blocks. | Needs a small piece of sending code, which Claude Code writes. Each service's API differs, so switching services means updating that code. |
If a tool asks you for SMTP settings, these are the four you'll fill in:
| Setting | What it is | Where it comes from |
|---|---|---|
| Server address | The email service's mail server | Your email service's help pages |
| Port | The numbered entry point to connect on | Your email service; 587 is common |
| Username | Your login for that server | Set by your service (SendGrid uses the word apikey) |
| Password | Proves it's you | Often your secret key |
Where does an email MCP server fit?
An email MCP server isn't a third way to send your live emails. It's a connector for building time. MCP (Model Context Protocol) is a standard way for Claude Code to use outside tools, and a connector is one of those links.
Through an email MCP server, Claude Code can set things up, send test emails and check send logs while you work in the chat. Once your SaaS is live, real emails go out from your project, using its secret key and sending code. Nothing goes through the chat.
With SimpleSends, Claude Code can also look into problems for you: if a user says an email never arrived, it reads the send logs and explains what happened. See how to check whether your emails actually sent.
What should you tell Claude Code?
You don't need to choose the route yourself. Tell Claude Code what you're building and ask for a recommendation in plain English.
For a new project:
I need my SaaS to send emails like welcome messages and password resets. Should we use SMTP or the email service's API for this? Explain your recommendation in plain English before you set anything up.
You'll get a short recommendation and the reasons for it. For most new projects, that's the API.
If a separate tool asks for SMTP settings:
My form builder wants SMTP settings: server address, port, username and password. Help me work out what goes in each box for my email service, and tell me which values I need to copy from my account.
You'll get the four settings, with a note on which ones are private.
If emails stopped after a hosting change:
Our emails stopped sending after we moved hosting. Check whether the new host blocks SMTP ports. If it does, suggest the simplest fix and wait for my go-ahead before changing anything.
You'll get a diagnosis and a proposed fix, often the email API or an alternative port.
Building with Claude Code? Connect SimpleSends and Claude Code can handle your transactional emails from here.
Frequently asked questions
Is SMTP or an email API faster?
For a single email, you won’t notice a difference. Both hand the email to your service within moments. SMTP needs several back-and-forth steps per message, while an API sends everything in one request, so the API has less waiting when your project sends a lot of emails at once. Delivery to the inbox after that depends on the service, not the route.
Is an email API more secure than SMTP?
Both can be secure. Email services encrypt SMTP connections on their recommended ports, and APIs use encrypted web connections. Both rely on a secret key, so the bigger risk is where that key is stored. Keep it out of your code and in your hosting settings, whichever route you use.
Can one email service offer both SMTP and an API?
Yes. Many services offer both, and you can use them side by side: the API for your own SaaS, and SMTP for a separate tool that only has SMTP settings. Resend and SendGrid both document SMTP alongside their APIs, and at both the SMTP password is your secret key.
Can I use SMTP with SimpleSends?
For your own SaaS, Claude Code sets up sending through SimpleSends with a secret key and a small piece of sending code in your project, so you don’t need to choose a route yourself.
Does using an email API mean SMTP isn’t involved at all?
No. The API only replaces SMTP for the handoff from your project to the email service. After that, the service still uses SMTP to pass your email to the receiving inbox’s servers, because SMTP is how email systems talk to each other across the internet.
Sources (5)
- RFC 5321: Simple Mail Transfer Protocol(checked October 5, 2026)
- Send emails with SMTP (Resend docs)(checked October 5, 2026)
- Send Email API reference (Resend docs)(checked October 5, 2026)
- Integrating with the SMTP API (Twilio SendGrid docs)(checked October 5, 2026)
- Why is SMTP blocked? (DigitalOcean docs)(checked October 5, 2026)
Keep reading
More on The prompt moment →Free Transactional Email Service Plans Compared (2026)
Compare each free transactional email service plan: monthly and daily limits, trials, account approval and branding, plus when it’s time to upgrade.
7 min read
What Is SMTP? A Simple Explanation for Non-Developers
What is SMTP? A plain-English guide to the standard that moves every email, where you’ll see SMTP settings, and how it compares to an email API.
5 min read
Transactional Email Pricing: What It Costs in 2026
Transactional email pricing compared: what Resend, SendGrid, Postmark, Mailgun and Amazon SES cost at 10,000 to 100,000 emails a month. Checked Oct 2026.
7 min read