SMTP Relay
📬 What is Relay in Exchange?
SMTP Relay in Exchange (on-prem or Exchange Online) is the process of allowing internal systems or devices (like printers, apps, or mail servers) to send emails via your Exchange server — either within your domain or externally.
It’s a way to let unauthenticated devices or apps send mail using your mail server without needing a full mailbox or login.
📡 Why Do You Need SMTP Relay?
Applications that generate alerts (e.g., monitoring tools)
Multi-function printers/scanners that email documents
Devices that cannot authenticate using modern protocols
Web services that send notification emails
🧩 Types of SMTP Relay in Exchange
Type | Description | Use Case |
---|---|---|
Internal Relay | Sends mail within your organization (accepted domains) | Internal apps, device alerts |
External Relay | Sends mail to external domains (outside your org) | Newsletters, app-generated email to customers |
Anonymous Relay | Allows unauthenticated clients to send mail through Exchange | Devices like printers or scanners |
Authenticated Relay | Requires valid credentials to relay | Secure app-to-email server connections |
🛠️ How SMTP Relay Works in Exchange
A device (e.g., a printer or app) sends an email via SMTP to the Exchange server.
Exchange receives the message.
If configured correctly, Exchange relays that message either internally or to the internet.
Exchange then routes and delivers the email to the recipient.
🧱 SMTP Relay in Exchange On-Prem (2016/2019)
To Enable SMTP Relay:
Create a Receive Connector with:
Port: Usually 25
Remote IP ranges: Only allow specific IPs (e.g., printers, apps)
Authentication: Allow anonymous (if needed)
Permission group: Enable "Anonymous Users"
⚠️ Important: Only allow relay from trusted IPs to prevent misuse (spam relay attacks).
☁️ SMTP Relay in Exchange Online (Microsoft 365)
You can set up relay in 3 ways:
Method | Description | Auth Needed |
---|---|---|
Direct Send | Send email directly from device to Exchange Online | ❌ No login needed |
SMTP Client Submission (SMTP Auth) | Use port 587 + TLS + credentials | ✅ Yes |
Microsoft 365 SMTP Relay | Use a connector in Exchange Online + trusted IP | ❌ No login, but IP must be whitelisted |
✉️ Common SMTP Relay Ports
Port | Usage |
---|---|
25 | Standard SMTP relay (used for internal and external relay) |
587 | SMTP submission with authentication and encryption |
465 | Deprecated (used for SMTPS, but not commonly in Exchange) |
❗ Common Issues with SMTP Relay
Issue | Cause | Fix |
---|---|---|
❌ Relay access denied | The IP is not authorized to relay | Add IP to allowed list in Receive Connector |
❌ Authentication required | App/device doesn’t support login | Use anonymous relay or allow relay by IP |
❌ TLS/Port issues | Wrong port or encryption setting | Use correct port (25 or 587), enable STARTTLS |
❌ SPF/DKIM failure | Sending domain not authorized | Add sending IP to SPF record in DNS |
❌ Mail goes to spam | No proper headers or auth | Use correct headers, consider authenticated relay or DKIM/DMARC setup |
✅ Best Practices
Only allow trusted IP addresses to use relay.
Use authenticated relay where possible for security.
Monitor relay usage to avoid abuse (spam or spoofing).
For Microsoft 365, use SMTP Relay Connector with static IPs and authentication.
🧪 Real-Life Example
You have a network printer that scans and emails documents. It doesn’t support login or TLS. You create a Receive Connector in Exchange on-prem that allows anonymous relay from the printer’s IP. The printer can now send scanned docs via email to users inside and outside the company.