What is an SMTP relay? How it works and when you need one
An SMTP relay sends your website's and app's email through managed infrastructure instead of your own server. Here is how it works, what it costs and how to set one up.
Your website sends more email than you might think: order confirmations, password resets, contact-form notifications, invoices, sign-up confirmations. When those messages land in spam, or never arrive at all, customers notice quickly.
Most of the time the problem is not the message. It is how it is sent. An SMTP relay fixes that by handing your email to infrastructure that was built for delivering it.
What is an SMTP relay?
SMTP (Simple Mail Transfer Protocol) is the standard that mail servers use to pass email to each other. An SMTP relay is a mail server that accepts email from your website or application and delivers it onward to your recipients' mailbox providers — Gmail, Outlook, Yahoo and the rest.
Instead of your web server trying to deliver mail directly, your software connects to the relay with a username and password, hands over the message, and the relay takes care of the rest: queuing, retrying, handling bounces and keeping a good sending reputation.
Why not send from your web server?
Most web hosts can send email, usually through PHP's mail() function or a local mail server. It works on day one and then causes trouble:
- Shared reputation. On shared hosting, hundreds of sites send from the same IP address. One compromised site sending spam can get the whole IP blacklisted.
- No authentication. Mail is often sent without proper SPF, DKIM and DMARC for your domain, which Gmail and Yahoo now expect.
- No visibility. You cannot see whether a message was delivered, bounced or marked as spam.
- Blocked ports. Many cloud providers block outgoing port 25 to fight spam, so direct delivery simply fails.
An SMTP relay solves each of these. Mail goes out from monitored IP addresses, signed for your domain, with a log of what happened to every message.
How an SMTP relay works, step by step
- Your app connects to the relay host (for example
smtp.example.com) on port 587, 465 or 2525. - The connection is encrypted with TLS, and your app logs in with its SMTP username and password.
- Your app sends the message — sender, recipients, subject and body — exactly as it would to any mail server.
- The relay checks it: is the From address on a verified domain? Is the recipient on your suppression list? Do you have the credits or quota to send?
- The relay signs and delivers the message to the recipient's mail server, retrying if that server is temporarily unavailable.
- Events come back: delivered, bounced, or complained. Hard bounces and complaints are suppressed automatically, and you can receive the events at a webhook.
Which port should you use?
| Port | Encryption | When to use it |
|---|---|---|
| 587 | STARTTLS | The standard port for sending from apps. Use this first. |
| 465 | SSL/TLS from the start | Use when your software asks for "SSL" rather than "TLS". |
| 2525 | STARTTLS | An alternative when your host or network blocks 587. |
| 25 | Optional | Server-to-server delivery. Often blocked for apps; avoid it. |
Whatever port you choose, make sure authentication only happens over an encrypted connection.
SMTP relay vs email API
Many relay services also offer an email API: instead of speaking SMTP, your code sends a JSON request over HTTPS.
- Use SMTP when your software already has SMTP settings — WordPress plugins, WooCommerce, CRMs, help desks, Laravel, PHPMailer, Nodemailer. You only change a host name and password.
- Use the API when you write the code yourself and want structured responses, message IDs, templates and metadata in one call.
Both deliver through the same infrastructure, so you can mix them: SMTP for your WordPress site, the API for your app.
What can you send through an SMTP relay?
A relay is built for email people expect:
- transactional email: receipts, order and shipping updates, password resets, account alerts;
- notifications from your app, CRM or help desk;
- newsletters and updates to people who signed up.
What you cannot send is unsolicited bulk email or mail to purchased lists. Reputable relays monitor bounce and complaint rates and pause accounts that cross safe limits — because one bad sender hurts everyone on shared infrastructure.
How to set up an SMTP relay
The steps are similar on every service:
- Create an account with the relay provider.
- Verify your sending domain by adding the DNS records it gives you: an SPF include, a DKIM key and a DMARC record. You can confirm them with our SPF, DKIM and DMARC checkers.
- Create SMTP credentials — ideally one set per application, so you can revoke one without breaking the others.
- Enter the settings in your software: host, port 587, encryption TLS, username and password, and a From address on your verified domain.
- Send a test and check the message log to confirm it was delivered.
For WordPress, an SMTP plugin is the usual route; for Laravel it is a few lines in .env. Our SMTP setup guide shows the exact settings for common platforms.
How much does an SMTP relay cost?
Pricing models vary:
- Monthly plans with an included number of emails, common with large providers.
- Pay-as-you-go, where you buy email credits and use them when you send. This suits sites whose volume changes from month to month.
- Free tiers, usually limited to a small daily volume and fine for testing.
When comparing, look beyond the price per email: check whether domain authentication, a message log, bounce handling and webhooks are included, and whether failed messages are charged.
Common problems and fixes
- "Authentication failed": check the username and password, and that your software is using TLS on port 587 or SSL on 465.
- "Sender not allowed" or similar: the From address must be on a domain you verified with the relay.
- Connection timeouts: your host may block the port. Try 2525.
- Mail delivered but in spam: confirm SPF, DKIM and DMARC pass, avoid sending from a free address like Gmail as your From address, and clean your recipient list with email verification.
The bottom line
If your website or app sends email that matters, an SMTP relay is the simplest way to make it reliable: authenticated mail from your own domain, a record of every message, and automatic handling of bounces and complaints. Setting it up usually takes less than an hour — most of it waiting for DNS.
InboxRoads includes an SMTP relay and Email API on ports 587, 465 and 2525, paid with the same pay-as-you-go credits as campaigns and verification.
Put this into practice with InboxRoads
Verify your list, authenticate your domain and send campaigns from one place. Pay only for the credits you use.