
An SMTP relay is a mail server that accepts a message from one system and passes it on to another, changing nothing in the message except to add a trace header. Every email crosses at least one. In everyday use the term also means a service you route outgoing mail through, such as a provider's host for mail from apps, printers and websites.
Both meanings matter for delivery. The server that hands your message to Gmail or Outlook is the one whose IP address, TLS and reputation the receiver judges. Choosing a relay is choosing who speaks for your domain.
What is an SMTP relay?
A relay is one of four roles a mail system can play, and it is the one in the middle. RFC 5321, the SMTP standard, defines it as a system that receives mail from an SMTP client and transmits it onward "without modification to the message data other than adding trace information."
SMTP is the Simple Mail Transfer Protocol, the language mail servers use to pass messages. The four roles in RFC 5321 are:
| Role | What it does | Example |
|---|---|---|
| Originator | Introduces mail into the transport system | Your mail platform or app server |
| Relay | Receives mail and transmits it to another server, adding a trace header | An outbound gateway, a provider's relay host |
| Delivery | Accepts mail and hands it to the mailbox | The recipient's mailbox server |
| Gateway | Translates mail between different transport systems | A link to a legacy mail system |
The trace header is the Received: line. Each relay adds its own at the top of the message, which is why you can read a message's path from the bottom up.
How does relaying work, hop by hop?
Relaying is a chain of short SMTP conversations, one per hop. Each server accepts the message, takes responsibility for it, and opens a new connection to the next server.
A message from a web app usually takes three hops:
- Submission. The app connects to its configured relay, signs in, and hands over the message.
- Relay. The relay looks up the MX record of the recipient's domain and connects to that server on port 25.
- Delivery. The recipient's server accepts or rejects the message, then files it in the mailbox.
Here is the trace a relay leaves. This is an illustration in the standard format, not a captured header:
Received: from app01.example.com (app01.example.com [203.0.113.10])
by relay.example.net with ESMTPS id 4f2a9c
for <customer@recipient.example>; Wed, 02 Dec 2026 09:14:07 +0000
Read it as: relay.example.net received this message from app01.example.com at the IP address 203.0.113.10, over an encrypted session. The recipient's server adds one more line above it, naming the relay as the sender. That last line holds the IP address the receiver scored.
What is the difference between a relay, a mail server and a smart host?
The terms overlap, because one machine can play several roles. An SMTP server is any server that speaks the protocol. A relay is a server passing mail that is neither from nor for its own mailboxes.
| Term | Meaning |
|---|---|
| SMTP server | Any server that accepts mail over SMTP. Covers all the roles below |
| Submission server | Accepts new mail from authenticated users and apps. Defined in RFC 6409 |
| Relay | Passes mail between servers without changing it |
| Smart host | A relay that another server sends all of its outgoing mail through, in place of delivering directly |
| SMTP relay service | A hosted relay you sign in to. It delivers your mail from its own IP addresses |
| Open relay | A relay that passes mail for anyone, with no sign-in and no restriction |
A smart host is the usual setup for an on-premises server, a printer or an app. The device knows one destination, the smart host, and the smart host handles MX lookups, retries and TLS.
Which ports does a relay use?
Relaying between servers uses port 25, and handing new mail to a relay uses port 587 or 465. The split is set by the standards, and it explains most connection errors.
| Port | Used for | Sign-in | Encryption | Source |
|---|---|---|---|---|
| 25 | Server to server relay and final delivery | None between unrelated servers | STARTTLS when both sides offer it | RFC 5321 |
| 587 | Submission of new mail by users and apps | Yes, by default | STARTTLS | RFC 6409 |
| 465 | Submission with TLS from the first byte | Yes | Implicit TLS | RFC 8314 |
RFC 6409 reserves port 587 for submission and says a submission server rejects mail by default when the session is not authenticated. It also says that message relay is unaffected and continues to use SMTP over port 25. RFC 8314, published in January 2018, asks clients and servers to support both STARTTLS on 587 and implicit TLS on 465.
Many home and cloud networks block outbound port 25. An app on such a network cannot deliver to recipient servers directly, so it submits to a relay on 587 and the relay does the port 25 leg.
What is an open relay, and why is it blocked?
An open relay is a server that accepts mail from any sender for any recipient and passes it on. Spammers use open relays to send at someone else's cost and under someone else's reputation, so a server that behaves like one is abused quickly.
The rule against it is old. RFC 2505, a best current practice from February 1999, says a mail server "MUST be able to restrict unauthorized use as Mail Relay." RFC 5321 agrees that servers may decline to relay, and gives 550 as the reply when the refusal is a matter of policy.
A correctly configured relay passes mail in only two cases:
- The recipient is one of its own domains, so the mail is inbound.
- The sender has proven who they are, by signing in or by connecting from an IP address the relay trusts.
Everything else gets a refusal. This is an illustration, and the wording differs from server to server:
MAIL FROM:<app@example.com>
250 2.1.0 Ok
RCPT TO:<someone@recipient.example>
550 5.7.1 Relaying denied
If your own app gets this reply, the relay is working as designed and your app has not authenticated. Fix the sign-in or the IP allowlist. Do not loosen the relay.
How do Google Workspace and Microsoft 365 relay mail?
Both offer a relay for devices and apps, with published limits and several ways to prove the sender. As of December 2, 2026, these are the options each one documents.
Google lists three routes on its page Send email from a printer, scanner, or app:
| Google option | Host | Ports | Sign-in | Limit | Can reach |
|---|---|---|---|---|---|
| SMTP relay service | smtp-relay.gmail.com |
25, 465 or 587 | IP address based | 10,000 recipients per user per day | Anyone |
| Gmail SMTP server | smtp.gmail.com |
465 or 587 | Full email address and an app password | 2,000 messages per day | Anyone |
| Restricted Gmail SMTP server | aspmx.l.google.com |
25 | None, IP allowlist | Per-user limits apply | Gmail and Google Workspace users only |
Google's relay settings page adds detail for the first option. As of December 2, 2026, it lists a limit of 10,000 messages per user in 24 hours and 100 recipients per SMTP transaction. It says the service is intended for mail from on-premises devices and apps, not for mail that starts in Gmail.
The same page says Google monitors relayed messages. If it detects a significant amount of spam from a user, it emails the account's super administrators.
Microsoft lists four routes on its page for devices and applications that send through Microsoft 365, last updated September 16, 2026:
| Microsoft option | Endpoint | Port | Sign-in | Limit | Can reach |
|---|---|---|---|---|---|
| Client SMTP submission | smtp.office365.com |
587 or 25 | Mailbox credentials, OAuth recommended. TLS 1.2 or later | 10,000 recipients per day, 30 messages per minute | Inside and outside the organization |
| SMTP relay through a connector | Your MX endpoint | 25 | A TLS certificate or a static public IP address | "Reasonable limits", no figures published | Inside and outside the organization |
| Direct Send | Your MX endpoint | 25 | None | Standard throttling, no figures published | Your own Microsoft 365 recipients only |
| High Volume Email | See Microsoft's HVE article | 587 | HVE account or OAuth token | No recipient or rate limits stated | Internal recipients only |
Two notes on the Microsoft table. Its page says dynamic IP addresses are not supported for the connector option, and that the connector option cannot be used for bulk mail. It also says client submission with Basic authentication is scheduled for deprecation, and it gives no date on that page.
When do you need a relay service?
You need a relay whenever the system that creates the mail should not, or cannot, deliver it to recipient servers itself. The common cases are narrow:
- Devices. Printers, scanners and alarms that can only speak basic SMTP to one host.
- Apps and websites. Order confirmations, password resets and form mail from a server whose network blocks port 25.
- On-premises mail servers. A server that sends everything through a smart host for filtering, archiving or a stable sending IP address.
- Volume the mailbox platform will not carry. Product and marketing mail beyond the per-user limits above. This is the job of a dedicated sending platform.
A relay is not a repair for a reputation problem. Mail that recipients mark as spam is judged the same way through any route, and providers watch relayed mail for spam, as Google's page says above. If that is your situation, start with how to stop emails going to spam.
Pointing a server at a relay takes a few lines. This is the client setup from the Postfix SASL documentation, with an example host:
smtp_sasl_auth_enable = yes
smtp_tls_security_level = encrypt
smtp_sasl_tls_security_options = noanonymous
relayhost = [relay.example.com]:587
smtp_sasl_password_maps = lmdb:/etc/postfix/sasl_passwd
The square brackets stop Postfix from looking up MX records for the relay name. The line smtp_tls_security_level = encrypt refuses to send the password or the mail without TLS.
What does a relay change for SPF, DKIM and DMARC?
A relay changes which IP address the receiver sees, so it changes what your SPF record has to authorize. It should leave the message body alone, so a DKIM signature added before the relay stays valid.
SPF, defined in RFC 7208, checks the connecting IP address against the domain in the envelope sender. After you add a relay, the connecting IP address is the relay's. The relay's addresses have to be in the SPF record of the envelope domain:
example.com. 3600 IN TXT "v=spf1 include:_spf.relay.example ~all"
Add the relay's include to the record you already have. A second SPF record breaks both, which we cover in multiple SPF records. You can confirm the result with our SPF checker.
Some relays rewrite the envelope sender to a domain of their own. SPF then passes for the relay's domain and not for yours, and DMARC, defined in RFC 7489, needs a domain that matches your From address.
Google documents a rewrite of a different kind. When the sender is not in your domains, its relay changes the envelope sender to a postmaster address on your domain. Check what your relay does before you rely on SPF for DMARC.
DKIM, defined in RFC 6376, is the safer anchor. A relay that follows RFC 5321 adds a trace header and changes nothing else, so the signature survives.
Sign with your own domain, at the app or at the relay, and DMARC can pass on DKIM whatever happens to the envelope. Our guide to SPF, DKIM and DMARC covers alignment in full.
| Check | What the receiver tests after a relay | What to set |
|---|---|---|
| SPF | The relay's IP address against the envelope domain | The relay's include in your one SPF record |
| DKIM | The signature over the headers and body | Signing with your domain, at the app or the relay |
| DMARC | Whether the SPF or DKIM domain matches the From domain | An aligned DKIM signature, or an envelope sender on your domain |
| Reverse DNS | The PTR record of the relay's IP address | Nothing on a hosted relay. The provider owns it |
| TLS | Whether the relay connects with TLS | Nothing on a hosted relay. Verify it in the header |
The last two rows are receiver rules as well. Google's email sender guidelines list valid forward and reverse DNS records and a TLS connection among the requirements for all senders, in effect since February 1, 2024.
As of December 2, 2026, the same page asks senders of more than 5,000 messages a day for SPF, DKIM and DMARC together. On a hosted relay, reverse DNS and TLS are the operator's to get right, and the three records stay yours.
How do we check a relay setup?
We check a relay from the receiving end, with one real message, because the configuration screen shows intent and the header shows what happened. The steps take a few minutes per sending system.
- Send a test to a mailbox we control at Gmail and at Microsoft 365, from the real app or device, not from a test tool.
- Read the top
Received:lines. We check which host and IP address made the final hop, and that the session used TLS. - Read the
Authentication-Resultsheader. We look for an SPF pass on a domain you own, a DKIM pass signed by your domain, and a DMARC pass. - Compare the envelope sender with the From address. A rewritten envelope is the usual reason SPF passes and DMARC still depends on DKIM alone.
- Check the relay's limits against real volume, per user and per day, so that a busy day does not end in refused mail.
- List every system that uses the relay. Old devices and forgotten apps keep sending for years.
On one multi-domain audit in our case studies, the count of unmanaged sending services went from 5 to 0. To see how your domain's records look today, run the free domain check.
What do relay errors mean?
Relay errors fall into three groups: the relay does not know you, the relay has throttled you, or the next server refused the relay. The reply code and the server that issued it tell you which.
| What you see | Who said it | Meaning | What to do |
|---|---|---|---|
A 550 reply that mentions relaying, at RCPT TO |
Your relay | It will not pass mail for you. You are not signed in, or your IP address is not allowed | Fix the sign-in or the allowlist |
A 530 reply at MAIL FROM |
A submission server | Authentication is needed first. RFC 6409 names this code | Turn on SMTP authentication in the app |
| A reply that names a rate or daily limit | Your relay | You passed a sending limit | Slow down, or move bulk mail to a platform built for it |
| A 5.7.60 reply from Microsoft 365 | Exchange Online | The signed-in account lacks permission to send as that sender | Grant Send As, or send from the mailbox's own address |
| A bounce that arrives later by email | The recipient's server | The relay accepted the mail and the next hop refused it | Read the bounce. The cause is the message or the reputation, not the relay setup |
The 5.7.60 text is on the Microsoft page linked above. For the other rows, the exact wording depends on the server software, so match on the code and the stage of the conversation and not on the words.
A relay that accepts your mail has only taken responsibility for trying. Delivery is decided at the last hop, by the receiver, on the same signals as any other mail: authentication, complaints and sending history.
Drafted with AI assistance from our own records and client work, then reviewed and approved by Kunal Arora. See our editorial policy.