### [What Is an SMTP Relay? How It Works and When You Need One](https://wpmailsmtp.com/smtp-relay/)

**Published:** August 14, 2026
**Author:** David Ozokoye

**Excerpt:** Wondering whether your WordPress site needs an SMTP relay?

Learn what an SMTP relay is, how the handoff works, and which port to use.

This guide covers why wp_mail() fails on its own, how Google's two SMTP endpoints differ, and how to check that your relay is working.

**Content:**

An SMTP relay decides whether your WordPress emails reach the inbox or vanish. Get it wrong and your receipts, password resets, and form notifications quietly disappear.

WordPress has no mail server of its own. It hands every message to whatever your host provides. That’s usually something slow, unauthenticated, or blocked outright.

Below, you’ll learn what an SMTP relay is, how the handoff works, and which port to use.

You’ll also learn why wp\_mail() fails on its own. Then you’ll see how Google’s 2 SMTP endpoints differ, plus how to test your relay. Let’s begin!

- [What Is an SMTP Relay?](#what-is-an-smtp-relay)
- [How SMTP Relay Works](#how-does-an-smtp-relay-work)
- [Why WordPress Needs an SMTP Relay](#why-does-wordpress-need-an-smtp-relay)
- [When Do You Need an SMTP Relay?](#when-do-you-need-an-smtp-relay)
- [Which SMTP Relay Port Should You Use?](#which-smtp-relay-port-should-you-use)
- [What's the Difference Between smtp-relay.gmail.com and smtp.gmail.com?](#whats-the-difference-between-smtp-relay-gmail-com-and-smtp-gmail-com)
- [Is SMTP Relay Going Away?](#is-smtp-relay-going-away)
- [How to Set Up an SMTP Relay on a WordPress Site](#how-do-you-set-up-an-smtp-relay-on-a-wordpress-site)
- [How to Know if Your SMTP Relay Is Working](#how-do-you-know-your-smtp-relay-is-working)

## What Is an SMTP Relay?

An SMTP relay is a mail server that sends your email for you. It accepts your outgoing message, then forwards it to the recipient’s server.

Think of it like dropping a letter at the post office. You hand it to a carrier that already has the routes and the reputation.

That reputation is the part that matters. A relay sends from IP addresses it actively protects. It signs your mail with DKIM. And it negotiates with Gmail and Outlook daily.

Most people use a hosted relay from an email service provider. You get credentials, plug them into your site, and the provider handles delivery.

### What’s the Difference Between an SMTP Relay and an SMTP Server?

An [SMTP server](https://wpmailsmtp.com/what-is-smtp-how-it-works/ "What is SMTP and how it works") is the software that sends, receives, and routes mail. An SMTP relay is one job that the server does. It forwards mail from a trusted sender to a domain it doesn’t own.

Every relay is an SMTP server. Not every SMTP server acts as a relay for you.

SMTP relaySMTP server**Main job**Forwards your mail to other domainsSends, receives, and routes mail**Direction**Outbound onlyInbound and outbound**Authentication**Requires your credentials or a trusted IPDepends on the role it plays**Who runs it**Usually a third-party providerYour host, your provider, or you**You need it when**Your site has to send mail reliablyYou’re running mail infrastructure**Note:** An SMTP relay is not the same as an open relay. An open relay forwards mail for anyone, with no authentication. Spammers abused them for years, so mail providers now block them on sight. Every legitimate relay requires authentication.

## How SMTP Relay Works

An SMTP relay works in 5 steps. Your site connects, encrypts, and authenticates. Then it hands the message over, and the relay delivers it.

Here’s the sequence:

1. **Connect.** Your site opens a TCP connection to the relay’s hostname on a submission port.
2. **Encrypt.** The connection upgrades to TLS, so credentials aren’t sent in the clear.
3. **Authenticate.** Your site proves who it is with a password, an API key, or an approved IP.
4. **Transfer.** Your site declares the sender and recipients, then sends the headers and body.
5. **Queue and deliver.** The relay accepts the message, signs it with DKIM, and delivers it.

![Diagram showing an SMTP relay between a WordPress site and the recipient mail server](https://wpmailsmtp.com/wp-content/uploads/2026/08/img_01_smtp-relay-handoff.png "How an SMTP Relay Sits Between Your Site and the Recipient")### What Happens at Each Step of the Handoff?

The handoff is a plain-text conversation. Reading one makes the whole process click. Here’s a real SMTP session with a relay, trimmed for clarity:

```

220 smtp.example.com ESMTP ready
EHLO yoursite.com
250-smtp.example.com
250-STARTTLS
250 AUTH LOGIN PLAIN
STARTTLS
220 2.0.0 Ready to start TLS
AUTH LOGIN
235 2.7.0 Authentication successful
MAIL FROM:
250 2.1.0 Sender OK
RCPT TO:
250 2.1.5 Recipient OK
DATA
354 Start mail input
(message headers and body go here)
.
250 2.0.0 OK: queued as 4A2F1C
QUIT
```

Every line starting with a number is the relay answering. The `250` codes mean success, and `235` confirms that your credentials worked.

That final `250 2.0.0 OK: queued` line matters most. Before it, delivery is your problem. After it, it’s the relay’s.

**Pro Tip:** Save that queued ID. When a customer says an email never arrived, the queue ID lets your provider trace what happened to it.

## Why WordPress Needs an SMTP Relay

WordPress needs an SMTP relay because it has no mail server of its own. By default, it hands mail to PHP, which passes it to your host unsigned and unverified.

Mail providers treat that kind of message as suspicious. It arrives with no proof it came from your domain. Often it comes from an IP shared with hundreds of sites.

![Comparison of the default WordPress PHP mail path and the SMTP relay path](https://wpmailsmtp.com/wp-content/uploads/2026/08/img_02_php-mail-vs-relay.png "Default WordPress Mail vs an SMTP Relay")### What Does wp\_mail() Actually Do by Default?

`wp_mail()` builds your message using the PHPMailer library. It then sends it through PHP’s `mail()` function. No SMTP connection, no login, no signature.

That default path fails in 4 specific ways:

- **No authentication.** Nothing proves the message came from your domain.
- **No DKIM signature.** Receiving servers can’t verify the content wasn’t altered.
- **Mismatched envelope sender.** The technical sender often doesn’t match your From address, so SPF alignment fails.
- **Shared IP reputation.** You inherit the reputation of every other site on your server.

An SMTP plugin like WP Mail SMTP fixes this by hooking into `phpmailer_init` and switching PHPMailer to SMTP. Here’s the core of what that hook does:

```

add_action( 'phpmailer_init', function ( $phpmailer ) {
    $phpmailer->isSMTP();                          // stop using PHP mail()
    $phpmailer->Host       = 'smtp.example.com';   // your relay hostname
    $phpmailer->Port       = 587;                  // submission port
    $phpmailer->SMTPSecure = 'tls';                // encrypt the connection
    $phpmailer->SMTPAuth   = true;                 // authenticate
    $phpmailer->Username   = getenv( 'SMTP_USER' );
    $phpmailer->Password   = getenv( 'SMTP_PASS' );
} );
```

**Warning:** Never paste SMTP credentials into a theme file or `functions.php`. Theme updates overwrite them. Anyone with file access can read them. Use environment variables or a plugin that stores them properly.

### Why Does Shared Hosting Make This Worse?

Shared hosting makes it worse for 2 reasons. Your host blocks the ports mail needs and shares your sending IP with strangers.

I’ve watched one spammy neighbor get a whole shared IP range blocklisted. A dozen innocent sites went down with it.

Most [hosts block outbound port 25](https://wpmailsmtp.com/why-your-web-host-blocked-smtp/ "Why your web host blocked SMTP") to stop that abuse. Some throttle mail to a few hundred messages an hour. Others silently drop anything PHP tries to send.

A relay routes around all of it. Your mail leaves over an authenticated connection on a port hosts don’t block. The sending IP belongs to a provider that defends it.

[Fix Your WordPress Emails Now](https://wpmailsmtp.com/pricing/)

## When Do You Need an SMTP Relay?

You need an SMTP relay once your site sends email someone is waiting for. Password resets, receipts, and form notifications all qualify.

Set one up in these cases:

- Your site sends any transactional email at all
- Test emails from WordPress fail or never arrive
- Your emails land in spam instead of the inbox
- You’re on shared hosting, where port 25 is usually blocked
- You need delivery logs to prove a message was sent
- You send more than a handful of messages a day

You can skip a relay in one narrow case. If your site is purely static, nothing needs to send. No forms, no accounts, no store.

**Note:** A single contact form counts. The moment a stranger fills it in and expects a reply, unauthenticated mail becomes a real risk to your business.

## Which SMTP Relay Port Should You Use?

Use [port 587 with STARTTLS](https://wpmailsmtp.com/smtp-port-587-vs-465/ "SMTP port 587 vs 465"). It’s the standard submission port, it’s encrypted, and hosts rarely block it.

PortEncryptionUse it whenBlocked on shared hosting?**587**STARTTLSAlmost always. The default choice.Rarely**465**Implicit TLSYour provider or host prefers itSometimes**2525**STARTTLS587 and 465 are both blockedRarely**25**Usually noneServer-to-server relay only. Not for your site.Almost alwaysPort 587 is the message submission port defined in [RFC 6409](https://www.rfc-editor.org/rfc/rfc6409 "RFC 6409: Message Submission for Mail"). Port 465 uses implicit TLS, so encryption starts before any commands are sent. [RFC 8314](https://www.rfc-editor.org/rfc/rfc8314 "RFC 8314: Cleartext Considered Obsolete") documents it.

Port 2525 isn’t in any RFC. Providers offer it as an unofficial fallback, and it works because firewalls generally ignore it.

**Note:** Port 25 still matters, just not to you. Relays use it to talk to each other. Your site should never send on it, and your host has probably blocked it anyway.

## What’s the Difference Between smtp-relay.gmail.com and smtp.gmail.com?

They’re 2 separate Google services, and they authenticate differently. `smtp-relay.gmail.com` is the Google Workspace relay for apps and devices. `smtp.gmail.com` is the Gmail SMTP server, which sends as one mailbox.

Mixing them up is the most common Google SMTP mistake I see.

smtp-relay.gmail.comsmtp.gmail.com**What it’s for**Apps, sites, and devices sending for your domainSending as one Gmail or Workspace mailbox**Requires Workspace?**YesNo**Authenticates by**Approved IP address, or SMTP credentialsMailbox credentials only**Send as**Any address on your verified domainOnly that mailbox address**Sending limits**Higher, set per Workspace accountLower, set per mailboxThe relay endpoint authenticates by IP range or domain. That suits a server sending for many addresses. The Gmail endpoint ties every message to one mailbox login.

Google documents the current limits in its [SMTP relay guide](https://knowledge.workspace.google.com/admin/gmail/advanced/route-outgoing-smtp-relay-messages-through-google "Route outgoing SMTP relay messages through Google"). Check there rather than trusting a number in a blog post, because Google adjusts these caps.

**Important:** On a free Gmail account, the relay endpoint isn’t available to you. It’s a Google Workspace feature. Your only Google option is `smtp.gmail.com`, with its lower limits.

## Is SMTP Relay Going Away?

No. SMTP relay is not going away, and Google’s relay service is still fully supported.

The confusion comes from a real change that people half-remember. Google retired the “less secure apps” sign-in method for Workspace accounts.

That change killed one way of logging in with a plain account password. It did not remove SMTP relay. Modern relays authenticate with app passwords, OAuth, API keys, or approved IPs instead.

The same pattern played out at Microsoft, which has been retiring basic authentication for SMTP. Again, the protocol stayed, and the weak login method went.

## How to Set Up an SMTP Relay on a WordPress Site

Set up an SMTP relay in 4 steps. Pick a provider and verify your domain. Then install an SMTP plugin and add your credentials.

### What Do You Need Before You Start?

Gather these first:

- A domain you send from, not a free Gmail or Yahoo address
- Access to your DNS records, for SPF and DKIM
- An account with an SMTP relay provider
- Administrator access to your WordPress site

Then work through it:

1. **Pick a relay provider.** Match the plan to your actual monthly volume, not your best-case scenario.
2. **Verify your sending domain.** The provider gives you DNS records to add. Adding them lets the relay sign mail as you.
3. **Install an SMTP plugin.** Go to **Plugins** » **Add New Plugin**, search for the WP Mail SMTP plugin, then click **Install Now** and **Activate**.
4. **Enter your relay details.** Add the host, port, encryption type, and credentials from your provider.

![WP Mail SMTP settings page showing SMTP host, port, and encryption fields](https://wpmailsmtp.com/wp-content/uploads/2026/08/img_03_wp-mail-smtp-smtp-connection-fields.png "Entering Your SMTP Relay Details in WP Mail SMTP")WP Mail SMTP handles steps 3 and 4 with a setup wizard. It also ships with built-in mailers for the major providers. Choosing a mailer beats entering raw SMTP details. The host and port get filled in for you.

**Pro Tip:** WP Mail SMTP includes multiple email providers, such as [SendLayer](https://sendlayer.com/pricing) and Brevo, that route your emails through a secure API. I recommend using a dedicated mailer over SMTP for WordPress emails. To learn more, see our list of [available email providers and how to configure them in WordPress](https://wpmailsmtp.com/docs/a-complete-guide-to-wp-mail-smtp-mailers/).

## How to Know if Your SMTP Relay Is Working

Send a test email, then read the message headers. You want 3 passes: acceptance, SPF, and DKIM.

WP Mail SMTP includes a test email feature for testing SMTP and mailer connections. To send a test email, go to **WP Mail SMTP » Tools** and open the **Email Test** tab. Enter the recipient’s email address in the **Send To** field.

![Send a test email](https://wpmailsmtp.com/wp-content/uploads/2024/10/test-email-tab.png)Once done, click the **Send Email** button. If your setup is correct, you’ll see a **Success!** message.

![Test email sent from WP Mail SMTP with Amazon SES mailer](https://wpmailsmtp.com/wp-content/uploads/2021/08/WP-Mail-SMTP-test-email-success-message.png)A test that only says “sent successfully” isn’t enough. That confirms the relay accepted your message, not that a real inbox did.

![WP Mail SMTP Email Test tab showing a successful test result](https://wpmailsmtp.com/wp-content/uploads/2026/08/img_04_wp-mail-smtp-email-test-result.png "Confirming Your SMTP Relay With a Test Email")Open the test email you received, view the original message, and look for:

- **`Received:` shows your relay’s hostname.** Confirms the mail went through the relay, not PHP.
- **`spf=pass`.** Your DNS authorizes the relay to send for your domain.
- **`dkim=pass`.** Your message carries a valid signature.
- **`dmarc=pass`.** SPF or DKIM aligns with your From domain.

If the test fails, the cause is almost always one of 3 things:

1. **Wrong port or encryption.** Try port 587 with STARTTLS, then port 465 with TLS.
2. **Rejected credentials.** Regenerate the app password or API key and re-enter it.
3. **Host blocking the connection.** Ask your host whether outbound SMTP is filtered, then try port 2525.

**Warning:** A passing test doesn’t guarantee inbox placement at Gmail. Send test messages to real accounts at Gmail, Outlook, and Yahoo. Check whether each lands in the inbox or the spam folder.

### Frequently Asked Questions

#### Is there a free SMTP relay?

Yes. Most relay providers include a free tier. Expect a few hundred to a few thousand messages a month. Free plans are fine for a small site’s form notifications and receipts. Check whether the free tier includes DKIM signing and logs, because some strip both.

#### Does Office 365 allow SMTP relay?

Yes. Microsoft 365 supports SMTP relay 2 ways. Use `smtp.office365.com` for authenticated client submission, or a connector for higher volume. Microsoft has been retiring basic authentication, so use modern auth or an app password.

#### Is an SMTP relay secure?

An SMTP relay is more secure than the default WordPress mail path. It encrypts the connection with TLS, requires authentication, and signs your mail with DKIM. Use port 587 or 465. Store credentials outside your theme files, and rotate them after any compromise.

#### How many emails can you send through an SMTP relay?

Limits depend on your provider and plan. Free tiers run a few hundred a month. Paid plans reach millions. Relays also enforce a sending rate, not just a monthly cap. Check both before a big send.

#### Do you still need SPF and DKIM if you use an SMTP relay?

Yes, and they matter more, not less. A relay can only sign as your domain if your DNS authorizes it. Add the [SPF and DKIM records](https://wpmailsmtp.com/dmarc-spf-dkim/ "What are DMARC, SPF, and DKIM") your provider gives you. Add a DMARC record once both pass.

## Next, Set Up Your WordPress SMTP Settings

Now that you know how a relay works, the next step is wiring it into your site. Our [guide to WordPress SMTP settings](https://wpmailsmtp.com/wordpress-smtp-settings/ "How to set up WordPress SMTP settings") walks through the exact fields and mailer options. It also covers the settings that keep your mail out of spam.

[Fix Your WordPress Emails Now](https://wpmailsmtp.com/pricing/)

Ready to fix your emails? [Get started today](https://wpmailsmtp.com/pricing) with the best WordPress SMTP plugin. If you don’t have the time to fix your emails, you can get full White Glove Setup assistance as an extra purchase, and there’s a 14-day money-back guarantee for all paid plans.

If this article helped you out, please follow us on [Facebook](https://facebook.com/wpmailsmtp) and [Twitter](https://twitter.com/wpmailsmtp) for more WordPress tips and tutorials.

**Categories:** WordPress Tutorials

---

