Every time you click Send in Gmail or Outlook, SMTP is doing the work behind the scenes routing your message from one server to another using a handful of plain-text commands. When that process breaks, figuring out where it went wrong can feel like guesswork. Telnet removes all that uncertainty by letting you talk to the mail server directly, one command at a time, and see exactly what it says back.
This guide is for developers and anyone who needs to diagnose email delivery problems at the protocol level. Whether you're setting up a new mail server, debugging a failed send, or just want to understand how SMTP actually works under the hood, this covers everything, installation on Windows, Linux, and Mac, the right ports to use, every command you need, and how to interpret every response you get.
Key Takeaways
- Telnet connects directly to an SMTP server at the protocol level, bypassing your email client entirely
- Port 587 with STARTTLS is the recommended port for testing. Port 25 is often blocked by ISPs. Port 465 uses implicit TLS — use OpenSSL instead of Telnet for port 465
- The core SMTP session is:
EHLO → MAIL FROM → RCPT TO → DATA→ type your message → end with a single dot on its own line →QUIT- Key response codes: 220 = server ready, 250 = accepted, 334 = authentication challenge, 354 = send message body now, 550 = permanent rejection
- Telnet cannot reliably verify if an email address exists — most servers return 250 OK for every address to prevent harvesting
- Telnet is a diagnostic tool, not a validation tool — it cannot detect catch-all servers, disposable inboxes, or whether addresses truly exist. For validating email addresses at scale, you can use the APIFreaks Email Checker API.
What Is SMTP?
SMTP (Simple Mail Transfer Protocol) is the standard protocol used to send emails across the internet. Every time you click "Send" in Gmail, Outlook, or any email client, your email service uses SMTP to route your message from the sender server to the recipient server.
SMTP works alongside two receiving protocols:
- POP3: Downloads emails to a local device
- IMAP: Syncs emails across multiple devices
SMTP handles only outgoing mail. It is a text-based, connection-oriented protocol, which is precisely what makes it testable with a plain-text tool like Telnet.
What Is Telnet?
Telnet is a networking protocol that lets one computer communicate with another over a TCP/IP network using plain-text commands. It was originally used to access remote terminals without physically walking up to a server.
Telnet works by connecting to a host and port via the syntax:
telnet <hostname> <port>It then opens a two-way text channel where you can type commands and receive server responses directly, making it ideal for manually interacting with text-based protocols like SMTP, FTP, and HTTP.
Why Use Telnet to Test SMTP?
When email delivery fails, the root cause could be anywhere, your email client, firewall, DNS, authentication, or the SMTP server itself. Telnet helps you isolate the SMTP server as a variable by bypassing your email client entirely.
Here's why developers use Telnet for SMTP testing:
- Direct server interaction: Communicates with the mail server at the protocol level over TCP
- Manual command execution: Send SMTP commands one by one and observe exact server responses
- Authentication testing: Verify that login credentials (username/password) work correctly
- Firewall/port diagnostics: Confirm whether a specific SMTP port is open or blocked
- Zero dependencies: No email client, SDK, or third-party tool required
- Recipient address probing: Check whether a mail server accepts a RCPT TO command, though note that most major providers (including Gmail) return 250 OK for any address as an anti-spam measure, so this is not a reliable way to verify email addresses
If you want to test your SMTP server without a terminal, the APIFreaks SMTP Checker Tool does this instantly from your browser, no installation needed.
SMTP Ports Explained
Before you test SMTP with Telnet, you need to know which port to use. SMTP uses three main ports:
| Port | Name | Encryption | Use case | Telnet compatible? |
|---|---|---|---|---|
25 |
SMTP | None / STARTTLS | Server-to-server relay. Often blocked by ISPs. | Yes |
587 |
Submission | STARTTLS | Client-to-server submission. Recommended for most clients and testing. | Yes |
465 |
SMTPS | Implicit TLS | Secure submission, TLS from the first byte. | No, TLS handshake required |
For this tutorial, use port 587. It is the standard for modern email submission and works with plain Telnet.
How to Install Telnet (Windows, Mac, Linux)
Telnet is not enabled by default on most modern operating systems due to its lack of encryption. Here's how to get it on each platform.
Windows 10 / Windows 11
Telnet is available on Windows but must be manually enabled:
- Open the Start Menu and search for "Turn Windows features on or off"
- In the Windows Features dialog, scroll down and check Telnet Client
- Click OK and wait for the installation to complete
- Open Command Prompt and type
telnetto confirm it's installed
Alternatively, enable it via PowerShell (Run as Administrator):
dism /online /Enable-Feature /FeatureName:TelnetClientmacOS
macOS removed the built-in Telnet client in macOS High Sierra (10.13). The easiest way to restore it is via Homebrew:
- Install Homebrew if not already installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"- Install Telnet:
brew install telnet- Verify installation:
telnet --versionLinux (Ubuntu / Debian)
sudo apt updatesudo
apt install telnet -yLinux (CentOS / RHEL / Fedora)
sudo yum install telnet -y
# or on newer Fedora:
sudo dnf install telnet -yAfter installation, verify with:
telnet --versionHow to Find Your SMTP Server Address
Before you can test SMTP with Telnet, you need the SMTP server hostname or IP address. Here are the most common ways to find it:
Option A: Check your email provider's documentation
Most providers publish their SMTP settings publicly. Common examples:
| Provider | SMTP Server | Port |
|---|---|---|
| Gmail | smtp.gmail.com |
587 |
| Outlook / Office 365 | smtp.office365.com |
587 |
| Yahoo Mail | smtp.mail.yahoo.com |
587 |
| Zoho Mail | smtp.zoho.com |
587 |
| Amazon SES | email-smtp.us-east-1.amazonaws.com |
587 |
Option B: Look up the MX record via nslookup or dig
If you want to find the mail server for a domain, use the nslookup command:Windows / Mac / Linux:
nslookup -type=MX example.comLinux (using dig):
dig example.com MXThis returns the mail exchanger (MX) records for the domain — the server responsible for receiving email for that domain.
Test SMTP with Telnet
Now let's connect to an SMTP server using Telnet. The command is the same on all platforms.
Step 1: Open your terminal or command prompt
- Windows: Press
Win + R, typecmd, press Enter - macOS: Press
Cmd + Space, typeTerminal, press Enter - Linux: Open your terminal application
Step 2: Connect to the SMTP server
telnet smtp.example.com 587Replace smtp.example.com with your actual SMTP server hostname and 587 with your target port.
Step 3: Interpret the connection response
If the connection is successful, you will see a 220 greeting from the server:
220 smtp.example.com ESMTP ready220The server is ready and accepting connections- If you see nothing or "Connection refused", the port may be blocked or the server is down
Step 4: Introduce yourself with EHLO
EHLO yourdomain.comThe server responds with a list of supported features:
250-smtp.example.com Hello [your IP]
250-SIZE 10485760
250-STARTTLS
250-AUTH LOGIN PLAIN
250 ENHANCEDSTATUSCODESThis tells you the server is alive, what authentication methods it supports, and whether STARTTLS encryption is available.
How to Send a Test Email via Telnet
Once connected and greeted, you can send a complete test email manually using the following SMTP command sequence. This is the full SMTP handshake.
EHLO yourdomain.com
MAIL FROM:<sender@yourdomain.com>
RCPT TO:<recipient@example.com>
DATA
Subject: SMTP Test via Telnet
From: sender@yourdomain.com
To: recipient@example.com
This is a test email sent manually via Telnet to verify SMTP connectivity.
.
QUIT
| Command | What it does |
|---|---|
EHLO yourdomain.com |
Greet the server, request extension list |
MAIL FROM:<you@domain.com> |
Set the envelope sender (not the From header) |
RCPT TO:<recipient@domain.com> |
Set the recipient |
DATA |
Tell the server you are about to send the message body |
Subject: Test: Message body. |
Type headers then body, press Enter |
. |
Single dot on its own line, signals end of message |
QUIT |
Close the session cleanly |
Full session with expected server responses:
telnet smtp.example.com 587
220 smtp.example.com ESMTP ready
EHLO testdomain.com
250-smtp.example.com Hello testdomain.com
250 AUTH LOGIN PLAIN
MAIL FROM:<you@testdomain.com>
250 2.1.0 Sender OK
RCPT TO:<friend@example.com>
250 2.1.5 Recipient OK
DATA
354 Start mail input; end with <CRLF>.<CRLF>
Subject: Test Email
From: you@testdomain.com
To: friend@example.com
Hello! This is a manual SMTP test.
.
250 2.0.0 OK: queued as A1B2C3D4
QUIT
221 2.0.0 ByeIf you reach the 250 OK: queued response, your SMTP server is working correctly.
How to Verify If an Email Address Exists Using Telnet
One practical use of Telnet SMTP testing is to check whether a specific email address exists on a mail server, without sending a real email.
Method: RCPT TO check
telnet smtp.example.com 25
EHLO test.com
MAIL FROM:<test@test.com>
RCPT TO:<targetuser@example.com>Interpreting the response:
| Response | Meaning |
|---|---|
250 Recipient OK |
Email address exists and is valid |
550 User unknown |
Email address does not exist |
550 Relaying denied |
Server blocks external RCPT checks |
452 Mailbox full |
Address exists but inbox is full |
If your Telnet results are unclear or you want a second opinion on your server connectivity, the APIFreaks SMTP Checker Tool runs the same test from a browser and shows you the raw server response, useful for cross-checking your output.
What SMTP Testing Cannot Tell You
- Catch-all servers: Many mail servers return 250 OK to any RCPT TO command, regardless of whether the mailbox exists. A 250 response does not confirm the address is real.
- Gmail and major providers: These return 250 OK for any address, including completely invented ones, as a deliberate anti-enumeration policy. Telnet cannot verify Gmail addresses.
- Scale: Telnet checks one address manually. If you need to validate a list of email addresses before sending, a dedicated tool or API is the right approach.
- Disposable inboxes: Even if an SMTP server confirms a mailbox exists, that address could belong to a temporary throwaway service. Telnet has no way to detect this. The APIFreaks Disposable Email Checker identifies disposable domains instantly, useful before allowing signups or adding an address to a list.
Telnet is a diagnostic instrument, not a validation tool. For anything beyond confirming a server is reachable, you need purpose-built tooling.
If your goal is to check whether email addresses on a list actually exist and will accept mail, something Telnet fundamentally cannot do reliably, the APIFreaks Email Checker API handles the full pipeline in a single call: syntax check, MX record validation, SMTP probing, catch-all detection, disposable inbox detection, and spam trap identification. The Bulk Email Validation API processes hundreds of addresses in one request.
SMTP Telnet Commands
Here is a full reference of SMTP commands you'll use during Telnet testing:

SMTP Response Codes
Understanding every response from an SMTP server is essential for diagnosing what's going wrong during a Telnet test.

Conclusion
Telnet is not a workaround, it is the most direct way to test SMTP. No client software, no abstraction layers, just your commands and the server's responses. Once you understand the five-command handshake, you can confirm connectivity, test authentication, and diagnose delivery failures in under a minute, on any platform.
That said, Telnet has real limits. It cannot open encrypted connections, it cannot reliably verify whether an email address exists, and it tests one thing at a time. For anything beyond manual spot-checking, validating address lists, detecting catch-all servers, or running SPF, DKIM, and DMARC checks, you need something built for the job.
Frequently Asked Questions
What is the difference between HELO and EHLO in SMTP?
HELO is the original SMTP greeting command. EHLO (Extended Hello) is its modern replacement and supports additional features like STARTTLS, AUTH, and SIZE declarations. Always use EHLO unless the server specifically requires HELO.
Why does Telnet not show what I'm typing?
This is a local echo issue. In Windows Telnet, type set localecho to enable echo. In PuTTY, enable "Local echo" in the Terminal settings. On Mac/Linux, this is usually handled automatically.
Can I test SMTP on port 465 with Telnet?
Port 465 uses implicit SSL/TLS from the very start of the connection. Telnet can't negotiate SSL. Use openssl s_client -connect smtp.example.com:465 instead.
My ISP or cloud provider is blocking port 25. What should I do?
Switch to port 587 for testing. For production email sending, contact your provider to request that port 25 be unblocked for outbound relay, or use a dedicated SMTP relay service (SendGrid, Amazon SES, Mailgun, etc.).
What's the difference between SMTP and ESMTP?
ESMTP (Extended SMTP) is the modern version of SMTP, introduced via the EHLO command. It adds support for authentication, encryption negotiation (STARTTLS), message size declaration, 8-bit MIME, and pipelining. Most servers today run ESMTP.
Can Telnet verify if an email address exists?
Not reliably. While you can issue a RCPT TO command and some servers will return 550 for non-existent addresses, most major providers, including Gmail, return 250 OK for any address regardless of whether it exists. This is an anti-enumeration policy designed to prevent spammers from harvesting valid addresses. For reliable email address verification, Telnet is not the right tool.
What is the difference between SMTP testing and email validation?
SMTP testing checks if your mail server is working. Email validation checks if a specific email address exists. They're different things, a working server can still bounce mail to fake addresses.
How do I test SMTP on port 587?
openssl s_client -starttls smtp -connect smtp.example.com:587Then type:
EHLO yourdomain.com
AUTH LOGIN
MAIL FROM:<you@example.com>
RCPT TO:<recipient@example.com>
DATA
Subject: Test
.
QUITWhat does a 550 SMTP error mean?
Permanent rejection. Common reasons:
550 5.1.1: Email address doesn't exist550 5.7.1: Relay denied, you're not authenticated550 SPF/DKIM/DMARC: Your domain failed auth checks550 Blocked: Your IP is on a spam blacklist
