SMTP via telnet

You can easily test a server’s SMTP connection via the command line using telnet.

Encoding using base64

If the SMTP server requires authentication, you’ll have to encode the username and password using base64.

To encode, just run the following:

echo 'text-to-encode' | base64

Make sure you encode the username and password separately, and keep them handy for future use.

Connecting to the SMTP server

Connecting to the SMTP server, you’ll need the server name or IP, and telnet installed.

telnet 25

You should receive a 220 response from the server, which looks something like this:


Once the connection is established, enter:



If the server does not require authentication, you can proceed to Sending The Message.

We now need to tell the server we’re ready to login:


You’ll be prompted in base64 to enter your username and password. Enter the encoded username and password separately.

Sending the Message

Enter the originating email address:


Enter the recipient:

RCPT TO: [email protected]

Enter the subject and email message:

Subject: My subject goes here

This is the body of the message.

Finalizing the message requires a . on a separate line.

To finish the telnet session: