SMTP relay service
SMTP encryption protects a connection, not automatically the entire email end to end. An SMTP TLS configuration encrypts email in transit between systems when they successfully establish TLS. SMTP commonly uses STARTTLS to upgrade a connection, while implicit TLS typically uses port 465.
A secure connection depends on more than one setting. The server must support TLS, present a certificate the connecting system can validate, and avoid falling back to an unencrypted connection when encryption is required.
This guide explains how SMTP TLS works and how to configure it. It covers the roles of ports 25, 587, and 465, certificate chains and self-signed certificates, provider support, and the risk of STARTTLS downgrade attacks. You’ll also learn which protocol settings to use and how protections such as MTA-STS and DANE affect email delivery security.
Key Takeaways
- Serve a certificate that matches the mail server’s hostname, and ensure the server can access the certificate files and chain.
- Distinguish opportunistic encryption from enforced TLS so a connection cannot silently fall back to plaintext when encryption is required.
- Check which TLS methods a sending or receiving system supports, then configure the connection method to match its role.
- Use the SMTP server’s technical specifications to assess whether it fits your email delivery requirements and security settings.
Table of Contents
Certificate chains and self-signed certificates
Enable STARTTLS in the SMTP server, configure its certificate and private key, and advertise the upgrade to connecting systems. A client then negotiates the TLS protocol before sending mail over the encrypted connection.
-
Generate and Sign a Host Certificate
Generate a certificate for the hostname that clients use to connect, then sign it with a certificate authority or an appropriate private authority. The documented OpenSSL command creates a certificate valid for 365 days. Check that the certificate identifies the correct hostname and that the private key remains protected from unauthorized access.
A self-signed certificate can encrypt a connection, but clients must be configured to trust it. For general internet mail, use a certificate chain that leads to a trusted authority. Let’s Encrypt provides Domain Validation certificates that email servers can use.
-
Check Certificates and Certificate Authorities
Before enabling TLS, verify the certificate’s hostname, validity period, signature, and chain. The receiving system uses these details to authenticate the server. A missing intermediate certificate can prevent chain validation even when the host certificate is valid.
Check the mail server documentation for certificate and key file settings, and ensure the server process can read both files. Symlinks may provide access, but file permissions can still block it. If access fails, use a process script to copy certificate files to an accessible path.
- Configure Sendmail’s TLS certificate macros for the CA certificate, server certificate, and private key. Point each macro to the correct file or certificate directory, then confirm Sendmail can read those paths. Reload the service after making changes, then test a STARTTLS connection to verify that the server presents the expected certificate.
- For domain-based certificate authentication, configure SMTP DANE with DNSSEC-protected TLSA records. SMTP DANE is specified by RFC 7672, and DNSSEC authenticates the TLSA records. RFC 7671 describes TLSA record use in DANE. Check that the published record matches the certificate or key material used by the server.
STARTTLS downgrade and STRIPTLS attacks
Configure SMTP to distinguish an upgradeable connection from one that requires encryption. A secure SMTP TLS configuration uses port 465 for implicit TLS, which starts before SMTP commands; TLS 1.2 is the minimum recommended protocol version, with TLS 1.3 preferred.
-
Test STARTTLS and Direct TLS Connections
Test STARTTLS on ports 25 or 587 by connecting in SMTP mode, issuing the STARTTLS command, and confirming the handshake succeeds. Test direct TLS separately on port 465, where encryption begins immediately. Verify the certificate hostname and negotiated cipher in each test. Record results by hostname and port so later configuration changes can be compared.
-
Check STARTTLS and SSL/TLS Compatibility
Configure each endpoint for its intended connection method. STARTTLS upgrades an existing SMTP connection; implicit TLS begins encryption before SMTP greetings. Match the client’s selected mode to the server listener. SSL 2.0 and SSL 3.0 have serious security issues and should not be used. TLS 1.0 and TLS 1.1 are deprecated under RFC 8996.
-
Review TLS Versions and Cipher Suites
Set TLS 1.2 as the minimum version and enable TLS 1.3 where supported. Review the server’s cipher settings and remove obsolete protocol options. Test negotiation with the sending system, then record the protocol and cipher selected. This documents how the SMTP TLS configuration behaves across supported connection methods without assuming every remote server has identical capabilities.
- Decide whether each mail route may accept plaintext when encryption cannot be negotiated. Opportunistic STARTTLS can permit that fallback. An attacker may remove the STARTTLS offer in transit, exposing the connection to a STRIPTLS downgrade. Researchers documented STRIPTLS attacks on international SMTP connections in 2014. Apply MTA-STS or DANE to strengthen policy enforcement, then test that required TLS failures do not silently become plaintext delivery.
Default TLS support from email providers
Review the sending and receiving mail servers separately because TLS support can vary by endpoint. Delivery may be affected when one server requires encryption but the other cannot establish it. Encrypted transport can support security controls, but does not by itself establish compliance.
-
Review Email Provider TLS Defaults
Review each provider’s SMTP documentation and test its advertised STARTTLS support. A provider may accept encrypted connections while still allowing plaintext delivery, so distinguish opportunistic TLS from enforced TLS. For Sendmail, inspect the active configuration and TLS macros instead of assuming encryption is enabled by default. Confirm that the certificate, private key, and trusted CA settings match the mail server’s hostname.
Use OpenSSL to test the handshake and inspect the certificate presented by the endpoint. Note whether the connection negotiates TLS and whether certificate validation succeeds. Change the configuration only after identifying the specific sending or receiving service.
-
Confirm the SMTP Port and Encryption
Use port 587 for authenticated email sending with STARTTLS. The connection begins as SMTP and upgrades to TLS when the client issues the command. Port 25 is traditionally used for server-to-server delivery, while implicit TLS typically uses port 465. Match the client’s connection mode to the server’s listening configuration.
Test the selected port with the intended protocol. A client expecting direct TLS cannot start with a plaintext SMTP greeting, while a STARTTLS client must request the upgrade. Confirm that encryption begins at the correct point in the session.
-
Assess Deliverability and Compliance Effects
Set the TLS policy to match the mail flow’s security requirements. Opportunistic TLS can preserve delivery when a remote server lacks encryption, but may allow plaintext fallback. A strict policy can protect transfers that require encryption, but delivery may fail if the receiving server cannot meet that policy.
Document the policy for each sending route and review connection results. Check TLS negotiation, certificate validation, and failed-delivery logs. These checks help distinguish a TLS configuration failure from other delivery problems, but encryption alone does not establish compliance with a particular standard.

How does SMTP encryption work in practice?
Require TLS by setting the SMTP policy to reject or defer delivery when encryption cannot be negotiated. Apply this rule to the specific connection or mail route that requires protection.
-
Identify SMTP Ports and TLS Methods
Match each SMTP port to its connection method. Port 25 commonly carries server-to-server delivery and can use STARTTLS. Port 587 commonly supports authenticated sending and upgrades through STARTTLS. Port 465 uses implicit TLS, so encryption starts before the SMTP greeting.
Check listener and client settings together. A STARTTLS client expects an SMTP greeting before sending the STARTTLS command; a direct TLS client expects encryption immediately. Mismatched modes prevent a successful connection, even when both systems support TLS.
-
Review TLS-on-Connect and SMTP Submission
Test TLS-on-connect on port 465 separately from SMTP submission on port 587. For port 587, confirm the server advertises STARTTLS and accepts the upgrade command before authentication or message submission. For port 465, confirm the TLS handshake completes before the SMTP greeting appears.
Use an OpenSSL test such as
openssl s_client -starttls smtp -connect mail.example.com:587for STARTTLS. For direct TLS, test the hostname and port without the STARTTLS option. Review the certificate and negotiated protocol in each result. -
Require TLS for SMTP Connections
Set the relevant server policy to require TLS rather than allow plaintext fallback. In Postfix, the
maysetting permits opportunistic TLS and accepts plaintext connections. Choose a stricter policy for routes that must remain encrypted, then test how the server handles peers that cannot negotiate TLS.Apply enforcement carefully across sending and receiving paths. A remote server without compatible TLS support may cause delivery to be deferred or fail. Check logs for the route, handshake result, and failure reason to distinguish a TLS issue from other SMTP delivery errors.
Review available SMTP server specifications to compare connection details against your sending requirements.
Xelin: SMTP server
Xelin’s SMTP server marketplace lists servers for email delivery needs. Use it to compare server options with your sending requirements, including the technical specifications relevant to TLS support.
Browse available SMTP server listings and review each entry’s specifications before choosing. Compare the documented connection details with your intended SMTP port, TLS method, and certificate requirements. This helps you assess whether a server fits your configuration needs; setup remains your responsibility.
Visit xelin.co to browse SMTP server listings.
Make TLS part of routine mail operations
Include transport security in your ongoing change process. Assign responsibility for reviewing mail server settings, documenting approved connection policies, and reassessing them when infrastructure changes. This makes SMTP TLS configuration an operational control rather than a one-time adjustment.
Before selecting a server, define your delivery requirements. Consider the connection method, certificate handling, and required level of TLS enforcement for your mail flows. Xelin’s SMTP server listings include technical specifications to help you compare options with those requirements. Choosing infrastructure is separate from configuration and ongoing administration.
For a server option that aligns with your email delivery needs, contact Xelin about email security. A clear requirements list will help guide your next step.
Frequently Asked Questions
What Is SMTP TLS?
SMTP TLS encrypts the connection used to transfer email between a client and a mail server, or between mail servers. An SMTP TLS configuration defines how that connection negotiates encryption and validates the server. TLS protects data in transit on that connection, but it does not encrypt every stored copy of a message or provide end-to-end encryption after delivery.
When Should You Pay Attention to TLS Configuration?
Review TLS settings when changing an SMTP server, updating a certificate, or diagnosing a failed connection. Revisit them when an application uses a different hostname or submission method. Use only email infrastructure and accounts you are authorized to access. Follow applicable anti-spam, privacy, and email-sending requirements, and do not use SMTP infrastructure to send unsolicited or deceptive messages.
What is SMTP TLS and how does it work?
SMTP TLS establishes an encrypted channel for an SMTP session. The systems negotiate TLS, then continue the email exchange through that protected connection. The receiving system can validate the sending server’s certificate and hostname. For example, a mail application can use TLS when submitting a message to an outbound server, while later server-to-server transfers use separate connections and security negotiations.
Which SMTP ports and TLS modes should be used: 25, 465, or 587?
Follow the server’s documented port and TLS mode rather than choosing solely by reachability. Port 25 is primarily for server-to-server mail transfer and may be blocked by some hosting providers or networks. Port 465 uses implicit TLS; TLS starts when the connection is established. Port 587 is used for message submission, commonly for email clients and applications; STARTTLS is commonly used to upgrade the connection to TLS.
How do you configure SMTP TLS certificates, hostnames, and certificate chains?
For SMTP TLS configuration, use a certificate whose hostname matches the server name in the sending application. Configure the server to present the required certificate chain, including intermediate certificates, and protect the private key. Validate the server’s TLS certificate; do not disable certificate checks to hide connection errors. Keep passwords and API credentials private and out of public source code.
How do you test and troubleshoot SMTP TLS with OpenSSL or online tools?
Test only systems you own or have permission to assess. For STARTTLS on port 587, use OpenSSL with the SMTP STARTTLS option and the authorized server hostname. Review the negotiated protocol, certificate chain, and verification result. Online testing tools can expose submitted hostnames or test details, so never enter passwords, private keys, session cookies, or complete SMTP credentials into public troubleshooting tools.