All emails are sent long distance through the SMTP system. When you send an email, it has to get from your email server to the email server of the recipient. This is guided by SMTP. The last hop from the email server to the recipient’s email client isn’t covered by SMTP – other protocols deal with that.
SMTP relays work by transmitting emails from one mail server to another, ensuring that emails can be sent from a sender to a recipient across different domains. Here’s a breakdown of how they function.
What is SMTP?
SMTP is short for the Simple Mail Transfer Protocol. It is the standard protocol used to send emails across the internet. It defines how email messages are sent between email servers.
A protocol is a set of standards. It isn’t a program, so a lot of companies have developed email systems, but all of them can talk to each other because they all follow the SMTP guidelines. The protocol covers issues such as message formats and code interpretation.
Without a universal standard, every email system developer would make up proprietary rules and the resulting sender would only be able to communicate with other email servers running the same program.
Purpose of an SMTP Relay
An SMTP relay is a mail server that acts as an intermediary, relaying email from the sender’s mail server (or client) to the recipient’s mail server. It is essential for:
- Sending email across different domains (e.g., sending an email from john@example.com to jane@anotherdomain.com).
- Improving email deliverability.
- Enabling bulk email sending by offloading delivery responsibility to specialized servers.
How SMTP Relays Work
Here’s a step-by-step process:
- Step 1: Email Creation An email is created by the sender using an email client or an application (e.g., Gmail, Outlook, or a web-based form). The email includes the recipient’s address, subject, message body, and possibly attachments.
- Step 2: Connection to the Outgoing SMTP Server Once the sender selects “Send”, the email client connects to the outgoing SMTP server (which may be provided by the email service provider or an SMTP relay service).
- Mail Transfer Agent (MTA): The email client communicates with a Mail Transfer Agent using the SMTP protocol, usually on port 25, 465, or 587.
- Step 3: SMTP Communication (Handshake) The SMTP protocol initiates a “handshake” between the sender’s server and the SMTP relay server. This handshake verifies the sender’s credentials, ensuring the email isn’t coming from an unauthorized source (to prevent spam).
- Step 4: Email Transmission Once authenticated, the email is transferred to the SMTP relay server. The server receives the email and performs basic checks (like validating the sender’s domain).
- Step 5: Routing the Email The SMTP relay server now needs to figure out where to send the email. It uses the recipient’s domain (e.g., anotherdomain.com) to perform a DNS lookup for the recipient’s mail server (the Mail Exchanger (MX) records). This tells the relay server which mail server is responsible for receiving email for the recipient.
- Step 6: Relaying the Email Once the recipient’s mail server is identified, the SMTP relay forwards the email to the destination mail server. This can involve multiple relays if the email needs to travel through intermediate servers.
- Step 7: Final Delivery The recipient’s mail server receives the email, where it gets stored in the recipient’s inbox or further filtered (e.g., checked for spam). When the recipient checks their email, their email client retrieves it from the mail server.
Benefits of Using an SMTP Relay
- Better Deliverability: SMTP relay services optimize deliverability by managing server reputation, avoiding blacklists, and ensuring proper email authentication (e.g., DKIM, SPF, and DMARC).
- Bulk Emailing: Relays allow businesses to send large volumes of email (transactional or marketing) without being flagged as spam.
- Infrastructure Offloading: Instead of managing your own mail servers, SMTP relays handle the heavy lifting of sending, queuing, and retrying failed emails.
- Scalability: SMTP relays are built to handle high volumes of emails, making them ideal for large businesses and apps.
Common Use Cases
- Transactional Emails: Sending emails like password resets, receipts, or account updates.
- Marketing Campaigns: Sending newsletters, promotions, and offers to a large list of subscribers.
- Application-Generated Emails: Automated alerts or notifications generated by software systems.
Authentication Methods
Authentication ensures that the email is being sent by a legitimate sender and not by a malicious actor. Here are the main methods SMTP relays use:
SMTP-AUTH
This is the most basic form of authentication, where the sender is required to provide a username and password before being allowed to send emails through the relay server.
How it works
When the email client connects to the SMTP server, it transmits the authentication credentials. If the credentials are valid, the server permits email transmission. This prevents unauthorized users from abusing the server to send spam or phishing emails.
Sender Policy Framework (SPF)
SPF is a method that allows the domain owner to specify which IP addresses or mail servers are authorized to send emails on behalf of their domain.
How it works
When an email is received by the recipient’s mail server, it checks the SPF record of the sending domain, which is published in DNS. If the IP address of the sending server matches the SPF record, the email is accepted. If not, it can be marked as spam or rejected. This protects against domain spoofing, where an attacker attempts to send emails using a forged sender address.
DomainKeys Identified Mail (DKIM)
DKIM adds a cryptographic signature to each outgoing email, verifying that the email has not been tampered with in transit.
How it works
The sending server signs the email with a private key, which is then validated by the recipient’s server using a public key published in the sending domain’s DNS records. This ensures that the email content has not been altered between the sender and recipient, enhancing the authenticity of the message.
Domain-based Message Authentication, Reporting & Conformance (DMARC)
DMARC builds on both SPF and DKIM and allows domain owners to specify how email receivers should handle messages that fail SPF or DKIM checks.
How it works
The domain owner publishes a DMARC policy in DNS, which instructs recipient servers on how to treat failed authentication. It also provides reporting, so domain owners can monitor potential abuse. DMARC prevents email phishing.
Encryption
Encryption ensures that email content is protected during transit, preventing it from being intercepted or read by unauthorized parties. SMTP relays implement encryption protocols such as:
Transport Layer Security (TLS)
TLS is used to encrypt the communication between the client and the SMTP relay server and between different SMTP relay servers.
How it works
If both the sending and receiving servers support TLS, the communication is encrypted during the SMTP handshake. This prevents man-in-the-middle (MITM) attacks, where an attacker intercepts and possibly alters communication between two parties.
STARTTLS
STARTTLS is an extension to SMTP that upgrades an unencrypted connection to an encrypted one using TLS.
How it works
The email transmission starts over a plain connection, and then a STARTTLS command is issued to begin encryption. This ensures that email content is encrypted without needing a separate secure connection upfront.
End-to-End Encryption (Optional)
Some advanced email systems also support end-to-end encryption, where only the sender and recipient can decrypt the message. SMTP relay services can pass these encrypted emails through but do not decrypt them, ensuring maximum security.
Examples include encryption protocols like PGP (Pretty Good Privacy) or S/MIME.
Anti-Spam and Filtering
SMTP relays must ensure that the emails passing through them are legitimate and not spam or malicious. This helps protect the server’s reputation and maintain high deliverability. Security mechanisms include:
- IP blacklisting and whitelisting: SMTP relays check the sending IP address against known spam or blacklist databases. The relay can block the email from being sent. Conversely, trusted IPs or domains may be whitelisted to ensure their emails are always accepted and delivered.
- Spam and phishing detection: Spam filters look for keywords, patterns, or behaviors associated with spam or phishing attacks. Bayesian filters and heuristic filters are commonly used techniques that analyze the content of the email and its metadata.
- Rate limiting: SMTP relay services may impose rate limits to prevent abuse, such as sending too many emails too quickly (a common behavior in spam attacks).
- Throttling: This technique controls the flow of emails, ensuring that emails are sent out at a reasonable pace, reducing the risk of being flagged as spam.
Bounce Management and Feedback Loops
SMTP relays help manage email bounces and provide feedback on delivery issues. This is crucial for maintaining a clean sender reputation:
Bounce Handling
When an email cannot be delivered (due to an invalid email address, full inbox, etc.), the SMTP relay generates a bounce message. These messages are classified as hard bounces (permanent failures) or soft bounces (temporary issues).
SMTP relays help manage these bounces to improve sender reputation by removing invalid addresses from the mailing list.
Feedback Loops
Many email providers offer feedback loops (FBLs) where they notify senders when recipients mark their emails as spam. SMTP relay services often integrate these loops to allow senders to adjust their lists and avoid sending further emails to users who consider their messages spam.
This feature helps improve deliverability and reduce the chances of the sender’s domain being blacklisted.
DKIM Replay Protection
Some SMTP relay services provide DKIM replay protection to prevent replay attacks, where a signed email is captured and resent repeatedly to trick email recipients. Replay protection mechanisms ensure that each email sent through the relay is unique, making replay attacks more difficult.
Distributed Denial of Service (DDoS) Protection
SMTP relay services are often targeted by DDoS attacks, which attempt to overwhelm the server by sending massive amounts of fake traffic to disrupt service. Many SMTP relay services employ:
- Traffic filtering and rate limiting: To block malicious traffic and prevent the relay from being overwhelmed.
- Load balancing: Distributing traffic across multiple servers to ensure that email services remain available even under attack.
Account Activity Monitoring and Alerts
Many SMTP relay providers offer monitoring tools that alert users to suspicious or abnormal account activity, such as:
- Large spikes in sent emails (indicating a possible compromise or spam attack).
- Multiple failed login attempts (potential brute-force attack).
- Abnormal patterns in recipient behavior, such as increased bounce rates.
Retries and Queuing
If the recipient’s server is down or not responding, the SMTP relay will retry delivery. It can queue the email and attempt multiple deliveries before returning a “bounce” or “undeliverable” error to the sender.
SMTP Relay Services
The following is a list of the most prominent SMTP relay services on the market today:
- MailerSend Offers a user-friendly email service for businesses, focusing on transactional emails with scalable SMTP relay, API access, and integrations. It includes real-time analytics, simple workflows, and collaborative tools for development teams looking to improve email delivery performance.
- SMTP2Go A robust global SMTP relay service known for reliable email deliverability and analytics. It provides detailed reports, including real-time tracking, and ensures emails bypass spam filters, making it ideal for businesses needing reliable transactional and marketing email delivery.
- SendPulse A versatile email marketing platform offering SMTP relay for transactional emails. It combines email automation, SMS, and push notifications, with user-friendly drag-and-drop campaign builders, making it suitable for both marketing and transactional communication needs.
- Brevo (formerly SendinBlue) Offers a full-suite email marketing platform with SMTP relay for transactional emails. It provides a range of tools like automation, segmentation, and detailed reporting, making it ideal for businesses looking to streamline both marketing and transactional messaging.
- Mailjet Provides reliable SMTP relay services alongside marketing tools for teams. It features email automation, collaborative tools, and in-depth analytics, allowing businesses to track and improve email deliverability while scaling transactional and promotional email campaigns effectively.
- Mailtrap A specialized email testing tool that also offers SMTP services in its advanced plans. Ideal for developers, it allows safe testing of email workflows in staging environments, ensuring correct functionality before going live, and preventing potential delivery issues.
- Postmark A transactional email service focusing on fast and reliable delivery. Its SMTP relay ensures immediate email dispatch, detailed email tracking, and excellent support for developers, making it ideal for businesses focused on sending critical transactional emails.
- SendGrid A popular cloud-based email service providing SMTP relay alongside a powerful API. It offers advanced analytics, segmentation, and email automation, making it a top choice for businesses needing to send high volumes of transactional and marketing emails at scale.
- Elastic Email Provides cost-effective SMTP relay services with comprehensive API access, detailed reporting, and extensive email campaign management features. It is a great solution for businesses seeking both transactional and marketing email services with scalability at competitive pricing.
- SMTP.com Offers enterprise-level email relay services with a focus on high-volume email delivery and exceptional deliverability rates. It provides real-time tracking, reputation management, and 24/7 customer support, making it ideal for businesses that rely on consistent, large-scale email sending.
- EmailSuccess Offers a dedicated SMTP relay platform focused on high deliverability for transactional and bulk emails. With powerful IP reputation management and comprehensive analytics, it caters to enterprises needing reliable, large-scale email distribution without deliverability issues.
- Inboxroad Provides an SMTP relay service designed to improve inbox deliverability for marketing and transactional emails. It focuses on high throughput, personalized customer support, and strong sender reputation management, making it a solid choice for high-volume email campaigns.
- Flowmailer Designed for transactional emails, offering an SMTP relay that ensures secure, fast, and reliable email delivery. Its focus on handling system-generated emails makes it ideal for businesses needing to send large quantities of transactional emails with ease.
- Mailgun A developer-focused email platform providing SMTP relay, APIs, and robust analytics for transactional and bulk emails. With features like advanced email routing, reputation management, and powerful tools for tracking deliverability, it’s widely used by developers and businesses alike.
- mySMTP Offers a dedicated SMTP relay service with a focus on deliverability and user-friendly integration. It provides real-time tracking, reputation management, and strong support, making it ideal for businesses seeking a simple yet reliable solution for sending emails at scale.
- Postmastery Specializes in optimizing email deliverability, offering SMTP relay alongside services for IP management, email monitoring, and consulting. It’s particularly suited for enterprises needing to ensure deliverability success and reputation management across high-volume email campaigns.
Conclusion
Your email provider will already be using its own SMTP relay when necessary. However, you don’t have to put up with that service and you can circumvent a slow or restrictive email service by subscribing to a commercial SMTP relay service.