What Is an SMTP Relay? A Plain-English Explanation
What is an SMTP relay? Plain-English guide: how it works, why browsers cannot speak SMTP, relay vs API, and why your own relay keeps credentials private.
The Send As Team
4 min read
An SMTP relay is a small server that takes an email from an app or device and passes it to a mail server for delivery, speaking SMTP, the standard protocol for sending mail. You need one when the thing sending cannot speak SMTP itself, such as a browser extension, and your mailbox only offers SMTP.
That situation is common now. Google’s notice says Gmail’s Send mail as for non-Google addresses ends in January 2027. Many of those addresses are hosted mailboxes (cPanel, GoDaddy and similar) that only offer SMTP, so replacing Gmail’s old path often means adding a relay.
How does an SMTP relay work?
- Your app hands the relay a message, usually over a normal HTTPS request, with a secret proving it is allowed to.
- The relay opens an SMTP connection to your mail server.
- It logs in with your SMTP username and password and submits the message.
- Your mail server delivers it to the recipient, signing it and applying your domain’s SPF and DKIM.
The relay does not decide whether mail is trusted. Your mail server and your DNS do. See the SPF, DKIM and DMARC explainer.
Why can’t browsers speak SMTP?
SMTP needs a raw network connection to a mail server on a specific port. Web pages and browser extensions are limited to web requests; they cannot open arbitrary TCP connections. So an extension cannot talk to smtp.yourhost.com directly. A relay bridges the gap: it accepts a web request and does the SMTP part.
Relay vs email API provider: which do I need?
| API provider | SMTP relay | |
|---|---|---|
| Examples | Resend, Postmark, SendGrid, Mailgun | Needed for hosted mailboxes, Yahoo, iCloud, Fastmail and others that offer SMTP |
| How the browser reaches it | Directly over HTTPS with an API key | Through a relay you deploy |
| Extra piece to run | None | One small Worker |
If your provider has an HTTPS API, use it directly and skip the relay. Our SMTP presets note which providers offer both. The comparison is in Resend, Postmark, SendGrid and Mailgun for Gmail.
What does the Send As relay look like?
Per our relay docs, it is a single open-source, MIT-licensed Cloudflare Worker that you deploy to your own Cloudflare account. It is stateless: no database, no storage, no logs of messages, subjects or recipients. It connects to your SMTP server on port 465 or 587 (also 2465 and 2525; port 25 is not available to Workers). It accepts only requests carrying your relay secret and only sends as the addresses you list.
Why does a relay on your own account keep credentials yours?
Your SMTP password is stored as a secret on your own Worker. The extension holds only the relay URL and relay secret. The project’s authors never host the relay, so they cannot see its secrets or reach it. Compare that with a hosted service, where the operator holds the credentials. Both are valid choices; see hosted relay vs manual setup. Practical safety tips:
- Prefer an app password or SMTP key to your main mailbox password.
- Use a long random relay secret (at least 32 characters).
- List only the addresses you need in the allowed senders setting.
- Revoke the SMTP password if you stop using the relay.
What can go wrong?
Most failures are mismatched port and security mode, or the wrong kind of password. Read SMTP port 465 vs 587 vs 2525 for the fixes. Also remember a relay only delivers; it does not fix SPF, DKIM or DMARC.
When should I not use a relay?
You do not need one if you already send through an HTTPS API, or if you only reply from your host’s webmail or a mail app. A relay is one more thing to maintain, so add it only when it solves a real gap. Updating is simple per our relay docs: the deployment creates a repository in your GitHub account, and pulling updates from the upstream repository makes Cloudflare redeploy.
Does a relay change who the mail is “from”?
No. The From address is set by the message, and your SMTP server must permit your login to send as it; otherwise it refuses with a “sender address refused” style error. The relay adds a second guard: it sends only as addresses you list. The deliverability of the message still depends on your mail server’s reputation and your DNS records, not the relay.
Is a relay the same as a mail server?
No. A mail server stores mailboxes and delivers mail to other servers. A relay only forwards submissions to one. The Send As relay stores nothing, so there is no mailbox, no queue of your messages and no history to leak. If the relay is down or misconfigured, your mailbox is unaffected; you simply cannot send through that route until it is fixed, and you can still use your host’s webmail as a fallback.
What to do next
Check whether your provider has an HTTPS API. If it does, use it directly. If it only offers SMTP, the relay docs show how to deploy one in a few steps, and /docs/setup shows how to connect the Send As extension, which is installed from GitHub for now (/install).
Frequently asked questions
What is an SMTP relay in simple terms?
An SMTP relay is a small server that accepts an email from one place and passes it on to a mail server for delivery. It acts as a middleman that speaks SMTP, the standard protocol for sending email, on behalf of an app that cannot.
Why can't a browser extension send email over SMTP?
Browsers and extensions can make web requests but cannot open raw TCP connections, which SMTP needs. A relay accepts a normal web request and makes the SMTP connection for you, so the extension can still send through an SMTP-only mailbox.
Is an SMTP relay the same as an email API like Resend or Postmark?
No. Providers such as Resend, Postmark, SendGrid and Mailgun expose an HTTPS API a browser can call directly. A relay is only needed when your provider offers just SMTP, as many web hosts do.
Is it safe to use an SMTP relay with my email password?
It is as safe as where the relay runs. If you deploy it to your own account, only you hold the credentials as secrets. Use an app password or SMTP key, not your main password, and never share the relay secret.
Keep reading
Self-Host an SMTP Relay on Cloudflare Workers (Open Source)
A free, open-source SMTP relay on Cloudflare Workers: what the Send As relay does, the one-click deploy, the secrets it needs, ports and what it never stores.
4 min read
SMTP Port 465 vs 587 vs 2525: Which to Use
SMTP port 465 vs 587 explained: implicit TLS vs STARTTLS, where 2525 fits, why port 25 fails on Cloudflare Workers, and how to fix 535 login errors.
4 min read
Easiest Way to Send From a Custom Domain in Gmail
The easiest way to send from a custom domain in Gmail: the hosted Send As relay vs your own provider key or Cloudflare relay, and the privacy trade-off.
4 min read