Telnet SMTP test: the manual session, and what changes when an agent runs it

A telnet SMTP test opens a raw session to a mail server, usually on port 25 or 587, sends EHLO and reads the reply to each command. An AI agent can run the same session from a shell, and it needs the server's exact reply, not a library's summary.

VerifiedBy Kam Low, Co-founder and CTO·Updated

What is a telnet SMTP test?

A telnet SMTP test manually connects to a mail server over the command line to test the SMTP conversation step by step, useful for low-level diagnosis of sending problems. In practice you open a session to the server on port 25, or 587 for submission, send EHLO, and read the reply code the server returns to each command after it.

Over an encrypted session on the submission port, the commands look like this, with the host and addresses replaced by the ones under test.

openssl s_client -crlf -quiet \
  -connect smtp.example.com:587 -starttls smtp
EHLO client.example.com
MAIL FROM:<[email protected]>
RCPT TO:<[email protected]>
QUIT

The -quiet flag matters. Without it, openssl reads a typed line that starts with a capital R as its own renegotiate command, so RCPT TO never reaches the server. -crlf sends the line endings SMTP expects. Port 465 is TLS from the first byte, so there you drop -starttls smtp and connect to smtp.example.com:465.

Without a login, a submission server usually answers MAIL FROM with 530, and that is a finding in itself: the host is up, TLS works and it wants authentication. Add an AUTH PLAIN <base64-credentials> line after EHLO only when the login itself is under test, and rotate that password afterwards.

To send one real message, carry on past RCPT TO with your own mailbox as the recipient. This sends a real email.

RCPT TO:<[email protected]>
DATA
Subject: SMTP session test

One line of test body.
.
QUIT

The single dot on its own line ends the message, and a 250 after it means the server accepted it. A coding assistant or an agent working over MCP runs unattended and treats whatever it reads as the answer, so how it runs the test matters as much as the result.

The same failure, two views of it
Through a librarySendError: message not sentthe reason is somewhere below this line, discarded
Raw session530 Authentication requiredsent after MAIL FROM, before any loginthe command and the reason, in order
Most servers now require TLS, so a plain cleartext session is usually refused.
A library summarizes. The session shows the reply code and the server's own text.

What changes when an AI agent runs a telnet SMTP test

An agent with terminal access can do what a sysadmin does by hand. It opens an encrypted session with openssl s_client -starttls smtp, sends EHLO, and reads every reply verbatim. Those codes are the diagnosis, and an agent reading them directly gets the detail a library would have thrown away.

SMTP reply codes an agent reads in a manual session

Reply codeWhat it meansWhat the agent does next
250The server accepted the commandMoves to the next command
421The server is closing the connectionReports it and stops, instead of reconnecting in a loop
530The server wants authentication firstReports that the host is up and needs a login
550The server refused the mailbox or the messageQuotes the server's text and checks the address or sender

The same access makes the session riskier. Past DATA it sends real mail, port 25 often times out from a cloud workspace, and a typed AUTH line stays in the agent's transcript. The failure list below covers each one.

What a manual SMTP session is for

Telnet (or openssl for encrypted connections) lets you type the SMTP commands by hand, EHLO, MAIL FROM, RCPT TO, and read the server's raw responses. It's the lowest-level way to see exactly where a send fails, favored by sysadmins debugging a stubborn server issue. A sending library usually reports a failure as one generic error, while the session shows which command the server rejected and the text it gave for rejecting it.

Why plain telnet on port 25 rarely works now

Plain telnet on port 25 rarely works from a typical network now. Many cloud hosts block outbound 25 by default, and most servers require TLS and authentication before they accept any mail command. In practice you use openssl s_client as above, on 587 with -starttls smtp or on 465 with TLS from the start.

The SMTP test page covers testing a mail setup before an app goes live. The manual session is the tool when one send fails and you need the server's own reply to a specific command. The SMTP commands reference covers what each command does and the replies to expect.

What a manual SMTP test does not prove

A manual SMTP test proves the server talks, not that mail reaches the inbox. That still depends on authentication and reputation.

Once the socket is proven, the useful next steps move up the stack. Sending a real test email to a seed set answers where the message lands, and a Mail-Tester score reports what the content and authentication look like from the receiving side. The testing hub covers the order to run them in, and email deliverability is the wider problem they are all sampling.

Worked example: an agent diagnoses a password-reset email that never arrived

The setup: the app sends each password-reset email through Nitrosend with nitro_send_message.

The prompt: "Users say the password-reset email never shows up. Find out why."

Before. Left unguided, the agent ignores the account, looks up a mail host and probes it by hand with openssl s_client. It types a full DATA block to its own address and reports success on a 250, which proves that host takes mail and says nothing about why users never got their resets.

After. With the Nitrosend MCP server connected, the agent asks the account instead of opening a socket.

  1. nitro_get_status reads the account context and readiness, and confirms which sender identity the reset email goes out from.
  2. nitro_get_insights pulls the account's email analytics, with trends and recommendations, so the agent can see whether resets are going out at all and when the numbers changed.
  3. nitro_manage_domains diagnoses the sending domain behind the reset email. In this example it finds a DNS record missing on that domain, which is the cause, and the fix is to publish that record at the domain's DNS host.
  4. nitro_review_delivery checks the reset template's content and readiness once the record is in place. It sends nothing.
  5. nitro_send_test_message sends a single real reset email from that template to the account's test recipient, never to users.
  6. A person opens the test reset, follows the link and confirms it works before the app's next nitro_send_message call goes out.
  7. nitro_get_insights is read again once the app resumes sending, to confirm the resets are going out and being delivered.

The agent's report names the cause, the missing record on the sending domain, the fix, and the delivery numbers after it, instead of a reply code from a session it did not need to open.

Where it goes wrong when an agent tests SMTP by hand

  • A timeout read as "server down". Telnet to port 25 from a cloud VM or CI runner usually hangs, because the host blocks outbound 25. An agent that reads the silence as an outage sends the whole investigation the wrong way. The guard: test the submission port from a network that allows it, 587 with -starttls smtp or 465 with TLS from the start, and report a timeout as a timeout.
  • A real DATA block sends a real email. Past DATA the session is no longer a test. The body the agent types, ended with a single dot, goes to whatever address it gave in RCPT TO. The guard: stop at RCPT TO, then QUIT, and go past DATA only to your own mailbox.
  • AUTH PLAIN base64 left in logs. AUTH PLAIN takes the username and password as one base64 string, which is encoding, not encryption. Typed into a terminal, it lands in the shell history, the agent's transcript and any CI log. The guard: leave AUTH out unless the login itself is under test, since a 530 on MAIL FROM already shows the server wants one, and rotate the password if it was typed.
  • The MX host tested instead of the submission host. The MX host receives mail for a domain, while the submission host accepts mail from the app. An agent that looks up MX records and tests those proves the domain can receive mail, which says nothing about why the app cannot send. The guard: test the host and port in the app's own mail settings.

How Nitrosend takes the socket out of the test

With an email API there is no socket to test. Running transactional email over your own SMTP plumbing means every port block and TLS mismatch is yours to diagnose by hand. An email API turns the same send into one authenticated request that returns an error the code can read when it fails.

That matters more with an AI agent in front of it, because typing raw SMTP commands into a socket is manual configuration at its most literal. Describe the send in Claude, ChatGPT or Cursor and the agent calls nitro_send_message through Nitrosend's MCP server. A failure comes back as an error, and an exact retry reuses the same idempotency_key, so a retry cannot send twice.

The larger risk with agent-run email is a silent failure: a send path that quietly stops and is caught days later. A socket test run once does not catch that. Catch it with failure events through email webhooks, or with a recurring health check of what did not send.

Reset links, receipts and other app mail go through the transactional email API, so a failed send comes back to the code as an error it can act on.

FAQ

What is a telnet SMTP test?

A telnet SMTP test is a manual session with a mail server. You connect over the command line, usually on port 25 or 587, type SMTP commands such as EHLO, MAIL FROM and RCPT TO, and read the raw reply code the server returns to each. It is used for low-level diagnosis when a send fails.

Does telnet still work for SMTP testing?

Rarely in its plain form. Many cloud hosts block outbound port 25 by default, and most servers require TLS before any mail command. Use openssl s_client instead: on port 587 with -starttls smtp, or on port 465, which is TLS from the first byte, so the -starttls flag is dropped.

Can an AI agent run a telnet SMTP test?

Yes. An agent with shell access can open the session with openssl s_client, send EHLO and read each reply code: 250 means accepted, 550 means refused. It should stop at RCPT TO so no real email goes out, and leave AUTH out unless the login itself is under test, then rotate that password.

Go deeper

Diagnose a send without opening a socket.

Simple pricing. Unlimited contacts.

Every plan includes full stack emailing: Flows, Newsletter Campaigns and Transactional Email, plus our NitroWheel LLM and all agent integrations (Claude, ChatGPT, Codex, Cursor and others). Pay for what you send, not who you store.

Choose your billing interval

Every paid plan includes 3 agent inboxes and no Nitrosend footer.

Starter

For your first email program.

$16USD / month

$192 billed yearly.

20,000 emails / month

Choose Starter
  • 5 brands · 3 seats
  • 5 custom sending domains
  • 500 email verifications/month
  • $1.50 / 1,000 extra emails

Pro

For a growing audience.

$40USD / month

$480 billed yearly.

60,000 emails / month

Choose Pro
  • 10 brands · 5 seats
  • 10 custom sending domains
  • 1,000 email verifications/month
  • $1.20 / 1,000 extra emails

Growth

For teams and agencies.

$120USD / month

$1,440 billed yearly.

200,000 emails / month

Choose Growth
  • Unlimited brands · 10 seats
  • 25 custom sending domains
  • 2,500 email verifications/month
  • $0.90 / 1,000 extra emails

Scale

For high-volume sending.

$240USD / month

$2,880 billed yearly.

500,000 emails / month

Choose Scale
  • Unlimited brands · 20 seats
  • 100 custom sending domains
  • 5,000 email verifications/month
  • $0.70 / 1,000 extra emails
Enterprise

Hey, big sender.

Sending 500,000+ emails a month? Get a custom plan designed for you, with volume email pricing and capacity that fits your business.

Start free. No card needed.

5,000 emails to start, then 500 emails every month. No expiry on your starter emails.

Start free

Daily allowances depend on your plan and sender standing. Strong list, domain and delivery evidence can raise standing, including on day one. Trusted receives the full plan allowance; available email credits, safety checks and delivery pacing still apply.

Free forever. No credit card required. See full comparison →