Introduction

Telnet can be used to manually test SMTP mail sending by communicating directly with a mail server. This method is commonly used for troubleshooting mail delivery issues and verifying SMTP server responses.


Prerequisites

Before using telnet for sending mail, ensure the following:

  • Telnet client is installed on your system
  • SMTP server is reachable on port 25
  • You have a valid sender email address
  • You know the recipient email address
  • Firewall allows outbound connection to port 25

To install telnet (if not installed):

sudo apt install telnet   # Ubuntu/Debian
sudo yum install telnet   # CentOS/RHEL

Steps to Send Mail via Telnet

Step 1: Connect to SMTP Server

Connect to your mail server on port 25:

telnet your-mail-server.com 25

You should see a response like:

220 mail.example.com ESMTP Postfix

Step 2: Identify Yourself (HELO/EHLO)

HELO your_domain.com

Response:

250 Hello

Step 3: Set Sender Email

MAIL FROM:<you@hostname.com>

Response:

250 OK

Step 4: Set Recipient Email

RCPT TO:<them@someplace.com>

Response:

250 OK

Step 5: Enter Message Body

DATA

Then type your email content:

Subject: Test Mail via Telnet

Hello,
This is a test email sent using telnet SMTP.

Regards,
Admin

End the message with a single dot (.) on a new line:

.

Response:

250 OK: queued as XXXXX

Step 6: Quit Session

QUIT

Response:

221 Bye

Conclusion

Sending mail via Telnet is a useful method to test SMTP connectivity and troubleshoot mail delivery issues. It helps verify whether the mail server is accepting connections and processing emails correctly at the protocol level.

Leave a Reply