How to Test an SMTP Server: Tools, Commands and a Full Diagnostic Workflow
A complete guide to testing SMTP servers — online testing, telnet and openssl commands, TLS verification, authentication checks and a repeatable diagnostic workflow.
A complete guide to testing SMTP servers — online testing, telnet and openssl commands, TLS verification, authentication checks and a repeatable diagnostic workflow.
When email stops working, the temptation is to debug from your application's logs. Resist it. Frameworks wrap, translate, and truncate SMTP replies, so the message you read is a paraphrase of a paraphrase. The single fastest way to diagnose an email problem is to talk to the server directly and read exactly what it says.
A proper SMTP test answers five questions in order, and each one depends on the last:
If step 1 fails, nothing about steps 2–5 matters. Working in order saves hours.
For most situations a browser-based test is the quickest path. Enter the hostname, port, encryption mode and credentials, and get back the full server transcript in a few seconds — no local tooling, no firewall on your laptop confusing the result, and a readable breakdown of each stage.
This is the right tool when you want to:
Use a dedicated test mailbox rather than production credentials whenever you can, and rotate anything you paste into a tool you do not control.
Telnet is the classic manual approach. It works only for plaintext connections, which in practice means port 25 or the pre-STARTTLS phase of 587.
telnet smtp.example.com 587A healthy session looks like this:
220 smtp.example.com ESMTP ready
EHLO test.example.org
250-smtp.example.com
250-STARTTLS
250-AUTH LOGIN PLAIN
250-SIZE 35882577
250 8BITMIME
QUIT
221 ByeWhat to look for:
Telnet cannot complete the STARTTLS handshake, so its usefulness ends there. Note also that many systems no longer ship a telnet client; nc (netcat) works identically for this purpose.
For anything involving TLS, openssl s_client is the right tool.
Implicit TLS on port 465:
openssl s_client -connect smtp.example.com:465 -crlfSTARTTLS on port 587:
openssl s_client -starttls smtp -connect smtp.example.com:587 -crlfBoth print the certificate chain, the negotiated protocol version and cipher, then hand you an interactive SMTP session.
Read these lines carefully in the output:
Verify return code: 0 (ok)
Protocol : TLSv1.3
Cipher : TLS_AES_256_GCM_SHA384A verify return code other than 0 means a certificate problem: expired, hostname mismatch, or a missing intermediate. Fix it properly — never disable verification in your application to work around it.
Once encrypted, you can authenticate manually. AUTH LOGIN expects Base64-encoded values:
printf 'you@example.com' | base64
printf 'your-app-password' | base64Then in the session:
EHLO test.example.org
AUTH LOGIN
334 VXNlcm5hbWU6
<base64 username>
334 UGFzc3dvcmQ6
<base64 password>
235 2.7.0 Accepted235 is the only success code. Anything else is a failure — see our SMTP error code reference for what each one means.
Be careful: commands typed into a terminal land in your shell history. Clear it afterwards, or use a throwaway credential.
To verify the whole path end to end:
MAIL FROM:<you@example.com>
250 2.1.0 OK
RCPT TO:<recipient@example.org>
250 2.1.5 OK
DATA
354 Go ahead
From: You <you@example.com>
To: Recipient <recipient@example.org>
Subject: SMTP test
Date: Thu, 15 Jan 2026 10:00:00 +0000
This is a test message.
.
250 2.0.0 OK: queued as 4A2B3CThe lone dot on its own line terminates the message. The queue ID in the final 250 is worth logging — it is the only handle for tracing the message later.
Three details commonly break manual tests: SMTP requires CRLF line endings (hence -crlf in the openssl commands), a blank line must separate headers from the body, and any line in the body that begins with a dot must be escaped by doubling it.
A working connection is only half of a working email setup. Check the DNS side too:
dig +short MX example.com
dig +short TXT example.com # SPF
dig +short TXT s1._domainkey.example.com # DKIM
dig +short TXT _dmarc.example.com # DMARC
dig +short -x 203.0.113.20 # reverse DNSReverse DNS deserves special attention for self-hosted senders. Your sending IP needs a PTR record that resolves to the hostname you present in EHLO, and that hostname must resolve forward to the same IP. Without matching forward and reverse DNS, several major providers reject your mail regardless of SPF and DKIM.
This is the mistake that wastes the most time. Your laptop and your production container have completely different network policies. A test that passes on your machine proves nothing about whether your application can send.
Always test from the environment that will actually send: the container, the VM, the CI runner, the serverless function. Cloud providers block outbound port 25 by default and corporate networks frequently filter 587 and 465 as well.
If a browser-based tester succeeds but your application fails, that discrepancy is itself the diagnosis — the server and credentials are fine, and the problem is egress filtering.
When email breaks, work this list in order and stop at the first failure:
dig +short smtp.example.com. No answer means DNS, not SMTP.nc -vz smtp.example.com 587. A timeout means a firewall; a refusal means nothing is listening.spf=pass, dkim=pass, dmarc=pass.Change exactly one variable between attempts. Changing the port and the credentials at the same time tells you nothing about which one mattered.
One-off testing catches configuration errors. Continuous testing catches the failures that appear later without warning: a credential that expired, a certificate that lapsed, a firewall rule added during a migration, a provider that changed a hostname.
Add a synthetic check that runs hourly, authenticates against your relay, and alerts on failure. It takes an afternoon to build and it will tell you about broken email before your customers do — which is the entire difference between a minor fix and an incident.
For everything else, keep a browser tab open on SMTPTester. Paste the host, port and credentials, read the full transcript, and you will know in seconds which of the five layers actually failed.
Apply what you just learned. Free, no signup, results in seconds.
Open the tool →How bounces work, the difference between hard and soft bounces, how to parse DSN messages, build a suppression list, and keep bounce rates under control.
Provider GuidesHow to send email through Microsoft 365 — SMTP AUTH settings, enabling authenticated SMTP, direct send, high-volume connectors, OAuth, limits and error fixes.