MailSlurp logo

guides

How to Send E-Mail via Telnet (SMTP Command Guide)

Send e-mail via telnet using protocol-correct SMTP commands. Follow a step-by-step terminal session for EHLO, MAIL FROM, RCPT TO, DATA, and QUIT.

Telnet gives terminal access to plaintext network services. You can use it to validate SMTP behavior quickly when debugging routing, connectivity, or command-sequence issues.

Installing telnet

Telnet comes with most Linux and Mac systems. On Windows machines you must enable telnet in the control panel programs and features section.

telnet

Connect to an SMTP server

Open a terminal and connect to an SMTP endpoint:

telnet mx.mailslurp.com 2525

Here we connect to a MailSlurp SMTP endpoint. Replace host and port with your own provider values.

Common ports:

  • 25: legacy relay (often blocked on cloud hosts)
  • 587: submission with STARTTLS
  • 465: implicit TLS (not suitable for plain telnet)
  • 2525: alternate SMTP endpoint on some providers

If you are unsure which port to use, see SMTP ports explained.

Send e-mail via telnet: SMTP session example

After connecting, run commands in this order:

EHLO example.local
MAIL FROM:<sender@example.com>
RCPT TO:<recipient@example.net>
DATA
Subject: Telnet SMTP test
From: sender@example.com
To: recipient@example.net

This is a test email sent via telnet.
.
QUIT

Important details:

  • EHLO starts an extended SMTP session and returns server capabilities.
  • MAIL FROM and RCPT TO must use mailbox syntax with angle brackets.
  • DATA starts message content mode; end with a single dot (.) on its own line.
  • Include at least Subject, From, and To headers for readability.

Why telnet sometimes fails on production SMTP

Many production SMTP providers require encryption and authentication before mail submission.

If your server requires STARTTLS or AUTH, plain telnet will not complete the full flow. Use:

  • openssl s_client -starttls smtp -connect host:587 for encrypted testing
  • application clients (Nodemailer, JavaMail, SMTP libraries) for auth-enabled send paths

What about receiving email?

SMTP is for sending. To retrieve messages, use POP3 or IMAP (different protocols and commands).

For inbox retrieval and test assertions, use:

BCC and CC

For more options see the BCC and CC SMTP guide.

Production next steps after telnet testing

Telnet is useful for protocol debugging, but production workflows need additional safety checks:

Wrapping up

Telnet can help you interact directly with an SMTP server, send a test email, specify sender and recipient addresses, and inspect the protocol flow in real time.

MailSlurp also supports email tracking, inbox automation, and email address APIs for teams that need repeatable email testing and automation beyond manual SMTP debugging.