On this page
  1. What an SMTP relay is
  2. How an SMTP relay works
  3. SMTP relay vs SMTP server vs your mailbox's SMTP
  4. Types of SMTP relay: authenticated, IP-restricted and open
  5. Why use an SMTP relay service
  6. How to set up an SMTP relay
  7. SMTP relay security
  8. Which SMTP relay service should you use
  9. FAQ

What Is an SMTP Relay?

An SMTP relay is a mail server that accepts a message from your app or server over SMTP, usually after you log in, and delivers it to the recipient's mail server, so your app does not have to deliver mail itself. RFC 5321 defines a relay as a server that receives mail from an SMTP client and passes it on.

Written by Relay, the Email Stack Review teamPublished No ads or affiliate links
Choosing a relay? See the best SMTP relay services.

Key takeaways

  • A relay takes your message, queues it and delivers it from its own IP address. Your app only talks to the relay.
  • Every relay is an SMTP server. Not every SMTP server relays mail for other people.
  • A normal relay needs a login or an allow-listed IP. A relay that accepts mail from anyone is an open relay, and you should not run or use one.
  • Use a relay service when you send app email and want logs, bounce handling and sender reputation handled for you.

Most people meet the word "relay" in a settings screen, next to a host, a port and a password. This page explains what sits behind those fields: what a relay does with your message, how it differs from an SMTP server, the three kinds of relay, and when you need one.

What an SMTP relay is

An SMTP relay is a mail server that accepts a message from your app or server over SMTP and delivers it onward to the recipient's mail server. RFC 5321 (section 2.3.10, checked November 2026) describes a relay as a server that receives mail from an SMTP client and transmits it without changing the message beyond adding trace information.

"Relay server", "mail relay" and "email relay" all mean this same thing. Postfix, the open-source mail server, names the setting for it relayhost, the next hop for mail that is not for the local machine (postconf(5), checked November 2026).

Why do apps use one? The relay owns the sending IP addresses, the reputation attached to them and the delivery work. Your app hands over the message and moves on. If you want to compare hosted relays, start with the best SMTP relay services.

How an SMTP relay works

An SMTP relay works in four steps: your app logs in and hands over the message, the relay queues it, the relay finds the recipient's mail server and delivers from its own IP, and the relay retries or reports a bounce if delivery fails.

  1. Your app connects to the relay host on a submission port and authenticates. RFC 6409 reserves port 587 for message submission, and a submission server must by default reject mail from a session that has not logged in (checked November 2026).
  2. The relay accepts the message and queues it. From this point the relay is responsible for it.
  3. The relay looks up the recipient domain's MX record and delivers from its own IP. RFC 5321 (section 3.6.2) notes that a relay is usually the target of a domain's MX record, not the final delivery system.
  4. The relay retries and reports. RFC 5321 (section 4.5.4) says the retry interval should be at least 30 minutes and the give-up time generally at least 4 to 5 days. A permanent failure comes back to you as a bounce.

Which port should your app use? Port 587 with STARTTLS is the default for app sending, and 465 is for implicit TLS. The full answer, with the settings for each service, is on SMTP ports.

SMTP relay vs SMTP server vs your mailbox's SMTP

Every SMTP relay is an SMTP server, but not every SMTP server relays mail for other people. An SMTP server is any server that speaks SMTP and can receive or send mail. A relay is one that accepts mail from a client and forwards it to other domains.

Term What it is Example Who runs it Typical use
SMTP server Any server that speaks SMTP, receiving or sending The mail server of a company or a mailbox provider Anyone Receiving mail for its own domains
SMTP relay A server that accepts mail from a client and forwards it to other domains A mail server your app logs in to An organisation or a vendor Forwarding mail for known senders
Relay service A hosted relay sold to apps The services in our relay ranking A sending vendor App email: receipts, password resets, alerts
Mailbox SMTP The outgoing server of a personal mailbox Gmail or Outlook.com settings The mailbox provider A person's own outbox, a few messages
Your own Postfix A mail server you install and operate A Postfix host with a relayhost set You Full control, all the delivery work on you

A relay service is the SMTP face of a sending service. The same vendor usually also offers an HTTP API, which is what SMTP vs email API compares. So "relay or email service provider" is rarely a real choice: you pick a provider, then use its relay, its API, or both.

Types of SMTP relay: authenticated, IP-restricted and open

SMTP relays come in three types: authenticated relays that need a login, IP-restricted relays that only accept listed sender addresses, and open relays that forward mail for anyone. If you were asked for the two main types, the answer is usually authenticated and open: a relay either checks who you are or it does not.

  • Authenticated relay. You log in with a username and password before the relay accepts mail. This is the normal case for relay services, and it matches RFC 6409, where a submission server rejects unauthenticated mail by default.
  • IP-restricted relay. The relay accepts mail only from sender IP addresses on an allow-list. It is common inside a company network, where the sending servers are known and stable.
  • Open relay. The relay forwards mail from anyone to anyone. RFC 5321 (section 3.3, checked November 2026) says a server may decline mail destined for other hosts, so refusing to relay for strangers is allowed.

Why is an open relay a problem? Spammers can send their mail through it. RFC 2505 (section 2.1, checked November 2026) says unauthorized use of a host as a mail relay means theft of its resources and puts the owner's reputation at risk. Mail that leaves through a relay spammers use shares that relay's reputation, so it is more likely to be treated as spam.

We do not publish a list of open relays. Using one means sending your mail through someone else's misconfiguration, and such a list only helps spammers. Use an authenticated relay instead.

Why use an SMTP relay service

Use an SMTP relay service when your app sends mail that people need to receive, such as receipts and password resets, and you do not want to run delivery yourself. The service takes on the parts that are hard to run alone.

  • Sending reputation. The relay's IP addresses already have a sending history, and many services handle warm-up for new dedicated IPs. Starting from a fresh IP of your own means building that history from zero.
  • Bounces and complaints. The relay processes them and tells you, so you stop sending to addresses that fail.
  • Logs. You can see what happened to each message, instead of reading a mail server's raw log.
  • Port 25 on cloud hosts. Many clouds block outbound port 25 by default. Microsoft's Azure documentation recommends authenticated SMTP relay services for sending from Azure VMs (checked November 2026). Which clouds block it, and how, is on SMTP ports.
  • SPF and DKIM once. You publish the records the relay gives you one time, and every app that uses the relay shares them. See what email authentication is.

When is a relay not worth it? A handful of messages from a personal mailbox does not need one, and neither does a server that only sends mail inside your own network.

What a relay does not give you is good content, a clean list, templates or batch sending. Templates and batch endpoints are features of an email API, covered in SMTP vs email API. If you plan to send bulk or marketing mail through a relay, read transactional vs marketing email first.

How to set up an SMTP relay

To set up an SMTP relay service, create an account, verify your domain, add the authentication records, create SMTP credentials, put them in your app with TLS on, and send a test message. The steps are the same for most services, and only the host, port and login change.

  1. Create an account and verify your sending domain. The relay needs to know you own the domain you send from.
  2. Add the SPF and DKIM records the relay gives you. They go in your domain's DNS. See what email authentication is.
  3. Create SMTP credentials. Most services issue a username and a password or API key for SMTP.
  4. Enter host, port, username and password in your app or server's SMTP settings, with TLS on. Use port 587 with STARTTLS unless the service says otherwise.
  5. Send a test message to a mailbox you own. Check that it arrives and that the authentication checks pass.
  6. Watch the logs and bounces. Fix address problems early, before they affect your reputation.

Host and port values differ for every service. Our per-service table of SMTP hosts, ports and TLS lists them side by side, copied from each vendor's docs.

Gmail and Microsoft 365 also offer relay connectors for your own tenant's mail. That is a different setup from a relay service, with its own steps in their admin guides, so we do not cover it here.

SMTP relay security

An SMTP relay is safe when the connection uses TLS, the credentials are protected, the relay is not open, and your domain has SPF, DKIM and DMARC records. Each of the four is a separate risk.

  • TLS in transit. RFC 8314 (checked November 2026) recommends implicit TLS on port 465 over connecting in cleartext and upgrading with STARTTLS. Both work when the client checks the certificate. The difference is in SMTP ports.
  • Credentials. Give each app its own SMTP credential if the service allows it, rotate it when someone leaves, and keep it out of client-side code and public repositories.
  • Open relay risk. If you run your own relay, make sure it refuses mail from strangers. A listed or abused relay damages deliverability, as covered in email blacklists.
  • Spoofing. A shared relay serves many senders. SPF, DKIM and DMARC records tell receivers which mail really comes from your domain. See what email authentication is.

Which SMTP relay service should you use

Pick by what you send and what you pay. Paid, developer-first relays are compared in the best SMTP relay services. Free ones are in free SMTP servers. If you write new code, an API may suit you better, so read SMTP vs email API.

How we compared: RFCs and official documentation, checked November 28, 2026. We ran no sending tests, and the site has no ads, affiliate links or paid placements.

Know what a relay is and ready to compare? See the best SMTP relay services.

SMTP relay: FAQ

What is an SMTP relay?

An SMTP relay is a mail server that accepts a message from your app or server over SMTP, usually after you log in, and delivers it to the recipient's mail server. Your app does not deliver the mail itself. See what an SMTP relay is and the best SMTP relay services.

What is the difference between an SMTP relay and an SMTP server?

An SMTP server is any server that speaks SMTP. An SMTP relay is one that accepts mail from a client and forwards it to other domains, so every relay is an SMTP server but not the reverse. See the comparison table.

Should I use port 465 or 587 for SMTP relay?

Use port 587 with STARTTLS by default, and port 465 if your service or library wants implicit TLS from the first byte. Your service's docs say which it supports. See SMTP ports.

What is an open relay and why is it a problem?

An open relay forwards mail from anyone to anyone. Spammers abuse it, and the owner's reputation suffers (RFC 2505, checked November 2026). Do not run or use one. See types of SMTP relay.

Is there a free SMTP relay?

Yes, some services have a free plan, and mailbox providers offer free SMTP with limits. We compare them in free SMTP servers.

How do I set up an SMTP relay service?

Create an account and verify your domain, add the SPF and DKIM records, create SMTP credentials, enter host, port and login in your app with TLS on, then send a test to your own mailbox. See the setup steps.

Is SMTP relay the same as SMTP authentication?

No. SMTP authentication is how the relay checks that you may send through it. A normal relay requires it, but a relay can also trust listed IP addresses instead of a login. See types of SMTP relay.

Can I use Gmail or Microsoft 365 as an SMTP relay?

Both offer relay connectors for your own tenant's mail, which is a different setup from a relay service, with steps in their admin guides. For personal mailbox SMTP, see free SMTP servers.