Testing SMTP Mail Flow Using Telnet

When troubleshooting mail flow issues between mail servers or to/from the internet, you can use Telnet to manually issue SMTP commands and observe responses.
This allows you to interact directly with the SMTP server, step by step, and see exactly where messages succeed or fail.
(Official Microsoft guide)


Example Session

Here’s a simple SMTP session example using Telnet:

EHLO exampledomain.com
MAIL FROM: sender@exampledomain.com
RCPT TO: recipient@example.com
DATA
Subject: Test email.

THIS IS A TEST EMAIL.
.
QUIT

What Each Command Does

  1. EHLO exampledomain.com
    Starts the SMTP conversation and identifies the client’s domain.
  2. MAIL FROM: sender@exampledomain.com
    Specifies the sender’s email address.
  3. RCPT TO: recipient@example.com
    Specifies the recipient’s email address.
  4. DATA
    Tells the server that the email body is about to be sent.
    After this command, type your message headers and body, then end with a single period (.) on its own line.
  5. QUIT
    Ends the SMTP session.

If everything is configured correctly, you’ll see responses such as:

  • 250 Sender OK
  • 250 Recipient OK
  • 354 Start mail input; end with <CRLF>.<CRLF>
  • 250 Message queued for delivery
  • 221 Bye

Why This Is Useful

  • Troubleshooting — Lets you verify mail delivery between servers without relying on a mail client.
  • Transparency — Displays raw SMTP replies, helping identify connection, authentication, or relay issues.
  • Verification — Confirms if your mail server is properly receiving and queuing messages.

Preparation Checklist

Before you begin testing:

  • Make sure Telnet is installed on your computer.
  • Identify the SMTP server address or domain you want to test.
  • Confirm that port 25 (SMTP) is open on your network or firewall.
  • Determine whether the destination server allows anonymous SMTP connections or requires authentication.

You can use the nslookup command (set type=mx) to find the MX record for a domain if needed.


Common SMTP Replies and Their Meanings

CodeMeaning
220Service ready
250Command completed successfully
354Start mail input
421Service not available (temporary)
450Mailbox unavailable (temporary)
550Mailbox unavailable (permanent)
530Authentication required

Each code gives insight into the state of your mail flow.
For example, 250 indicates success, while 550 means the recipient address was rejected.


Example Review

Using the sample commands:

EHLO exampledomain.com
MAIL FROM: sender@exampledomain.com
RCPT TO: recipient@example.com
DATA
Subject: Test email.

THIS IS A TEST EMAIL.
.
QUIT

If the session completes successfully, you’ve verified that the SMTP connection works and the message can be accepted for delivery.

If an error occurs (for example, “550 User unknown” or “530 Authentication required”), use that response to troubleshoot DNS, authentication, or connector settings.


Best Practices

  • Use Telnet only for testing — it’s a plaintext protocol and should not be used for sending real emails.
  • Always note the status codes and messages when diagnosing issues.
  • Ensure your mail server is not an open relay (rejects unauthorized senders).
  • If testing across networks, verify that your ISP or firewall doesn’t block outbound port 25.

Conclusion

Using Telnet to test SMTP mail flow is a simple and effective way to confirm that your mail server is properly configured.
By issuing basic commands and reviewing the server’s responses, you can quickly pinpoint where delivery succeeds or fails — an invaluable tool for diagnosing and resolving mail flow issues.


Scroll to Top