Use-cases

SMTP relay service: send email from any app, printer or server

Short answer

An SMTP relay service accepts email from your app, server or device over authenticated SMTP and delivers it for you from servers with a good reputation. You give your software a host, a port (587 with STARTTLS or 465 with TLS), a username and a password, and verify your sending domain with SPF, DKIM and DMARC. It is the easiest way to get reliable mail out of software that only speaks SMTP.

Last checked 16 November 2026

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:

  1. Domain authentication. The relay must DKIM-sign with your domain and let you set a custom return path so SPF aligns for DMARC.
  2. Revocable credentials. Each app or device should get its own credential so you can rotate one without touching the others.
  3. Visibility. A searchable log of what was sent, delivered and bounced, ideally with webhooks.
  4. Clear limits. Know the per-second and per-day limits before your monthly invoice run hits them.
  5. 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@localhost or 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.

Questions

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

Every relay is an SMTP server. The word relay means it accepts mail from you and passes it on to the recipient's server, instead of storing it in a mailbox. A relay service adds authentication, reputation management and delivery tracking.

Which port should I use for SMTP relay?

Use 587 with STARTTLS or 465 with implicit TLS. Port 25 is for server-to-server delivery and is blocked or throttled by many cloud and home networks.

Can I use Gmail as an SMTP relay for my app?

You can for small personal volumes, but Gmail limits daily sending and is not built for app mail. A relay service lets you send from your own domain with proper DKIM signing and bounce handling.

Is an SMTP relay slower than an email API?

Each message needs an SMTP conversation, which takes a few round trips more than one HTTPS request. For a printer or a CMS that is irrelevant. For high-volume app sending, an API or pooled SMTP connections are faster.

Do I need to verify my domain to use an SMTP relay?

Yes, with any reputable relay. Without SPF, DKIM and DMARC on your domain, receiving servers have no reason to trust the mail and much of it will land in spam or be rejected.

Related

Send with someone on your side.

Unlimited domains on every plan, a person before any block, and 3,000 emails a month free. Tell us what you send and we set you up within one business day.