An SMTP relay service takes email from your software over authenticated SMTP and delivers it to recipients from servers that mailbox providers already trust. You configure four values (host, port, username, password), verify your domain, and anything that can send email, from a WordPress site to an office scanner, sends through it.
Why use a relay instead of sending directly?
Your app could in theory deliver mail itself by looking up the recipient’s MX record and connecting on port 25. In practice that fails for three reasons:
- Port 25 is blocked. Many cloud providers and ISPs block or throttle outbound port 25 to stop spam.
- Your IP has no reputation. A fresh server IP, often in a range that once sent spam, is treated with suspicion by Gmail and Microsoft.
- No feedback. You would need to process bounces, retries and complaints yourself.
A relay solves all three. It listens on submission ports (587 and 465, defined in RFC 6409 and RFC 8314), signs your mail with DKIM, retries temporary failures, and tells you what happened.
The settings every device needs
| Setting | Typical value | Notes |
|---|---|---|
| Host | smtp.yourprovider.com |
Never an IP address; certificates are issued for names |
| Port | 587 or 465 | 587 starts plain and upgrades with STARTTLS; 465 is TLS from the first byte |
| Encryption | STARTTLS on 587, SSL/TLS on 465 | Mismatching the two is the most common setup error |
| Username | Provider specific | Often a fixed word or your account name |
| Password | An API key or SMTP credential | Use a key you can revoke, not your account password |
| From address | alerts@yourdomain.com |
Must be on a domain you have verified |
If your device offers “SSL” and “TLS” as separate options, “SSL” usually means implicit TLS on 465 and “TLS” means STARTTLS on 587. Our SMTP ports guide covers the history of 25, 465, 587 and 2525.
How to choose an SMTP relay service
Look past the price per thousand emails and check these:
- Domain authentication. The relay must DKIM-sign with your domain and let you set a custom return path so SPF aligns for DMARC.
- Revocable credentials. Each app or device should get its own credential so you can rotate one without touching the others.
- Visibility. A searchable log of what was sent, delivered and bounced, ideally with webhooks.
- Clear limits. Know the per-second and per-day limits before your monthly invoice run hits them.
- An API as well. Your app may outgrow SMTP. A provider that offers both lets you switch without moving domains.
Example: a relay setup for apps and devices
Here is a plain notification an office device or cron job might send. Keep it short, from a real domain, with a text part.
From: Office Scanner <scanner@acme.com>
To: finance@acme.com
Subject: Scan from 3rd floor printer, 4 pages
Your scan is attached as scan-0412.pdf.
Sent by the 3rd floor printer. Reply to it-help@acme.com with any problems.
Configuring Mailcandor as your relay
Mailcandor runs an SMTP relay alongside its email API, with the same log, limits and webhooks for both. The settings are:
| Setting | Value |
|---|---|
| Host | smtp.mailcandor.com |
| Port | 465 (TLS) or 587 (STARTTLS) |
| Username | mailcandor |
| Password | a Mailcandor API key |
Create a sending-only key for each device or app, and lock it to the domain it sends from. A leaked printer key then cannot send as anything else, and revoking it breaks nothing else.
To test from a terminal, Python’s standard library is enough:
import os, smtplib
from email.message import EmailMessage
msg = EmailMessage()
msg["From"] = "Office Scanner <scanner@acme.com>"
msg["To"] = "finance@acme.com"
msg["Subject"] = "SMTP relay test"
msg.set_content("If you can read this, the relay works.")
with smtplib.SMTP("smtp.mailcandor.com", 587) as s:
s.starttls()
s.login("mailcandor", os.environ["MAILCANDOR_KEY"])
s.send_message(msg)
For port 465, use smtplib.SMTP_SSL("smtp.mailcandor.com", 465) and drop the starttls() call. Device-specific steps are in the printer and scanner SMTP guide. Unlimited domains are included on every plan, and the pricing page has the details.
Verify your domain before you send
Whichever relay you choose, publish the DNS records it gives you:
- SPF authorizes the relay’s servers to send for your domain (or for its bounce subdomain).
- DKIM lets receivers check the message was not altered and really came from your domain.
- DMARC tells receivers what to do when both fail, and gives you reports.
The SPF, DKIM and DMARC setup guide walks through each record. Since February 2024, Gmail requires SPF or DKIM from every sender and all three from bulk senders, per Google’s sender guidelines.
Common pitfalls
- Wrong encryption for the port. STARTTLS on 465 or implicit TLS on 587 produces timeouts or handshake errors. Match them.
- Sending from an unverified address. Old devices often default to
scanner@localhostor the device’s serial number. Set a real address on your verified domain. - Shared credentials. One password across ten devices means rotating it breaks ten devices. Give each its own key.
- Old TLS only. Some older printers support only TLS 1.0 or 1.1, which modern relays refuse. Update the firmware, or run a small local relay such as Postfix that accepts from the device on your network and forwards over modern TLS.
- Ignoring bounces. A relay that reports bounces only helps if someone reads them. Route bounce webhooks somewhere a person sees.
- Bulk mail over a single connection. Sending thousands of messages one SMTP session at a time is slow. Reuse connections, or use an HTTP API for volume.