An SMTP server malfunction can be overcome by connecting to an application protocol like Telnet directly from your local computer.

What is SMTP?

Simple Mail Transfer Protocol (SMTP) is among the TCP/IP protocols used by email services to route your message to the recipient anytime you send a message.

What is Telnet?

Telnet(teletype network) is a networking protocol aiding a computer to access another, imparting a two-way channel for text-based communication between two or more devices.

With a command prompt and the syntax telnet hostname port, a user can communicate with another computer or command another server using Telnet. Unfortunately, it does not support encryption.

Why is Telnet used to test SMTP servers?

Telnet protocol is among the simplest ways to establish a Transmission Control Protocol between devices because it allows for sending plain-text information over a single TCP connection.

Selection between: port 25 and port 587.

Since your application needs both port 587 and SSL/TSL, port 587 is preferable to test an SMTP connection and add additional security.

Setting up Telnet

Guide to test out an SMTP server using port 587 using Telnet.

For Windows

  • Install Telnet. Then, navigate to the `Control panel->Programs->Click "Turn Windows features on or off."’
  • Scroll down to Telnet client. Click the checkbox to enable it.

For Linux

  • Install Telnet using Yum if Fedora and Centos, or Apt on Debian and Ubuntu.

Command:

Depending on Linux System's configuration, use sudo to run Yum or Apt.

OSX

Mac users with installed Homebrew can open a terminal using the command:

Installing SSL

Here we have used SSL for encryption along with port 587.

We have installed OpenSSL on Windows.

For Linux, install OpenSSL using Yum or Apt with the command:

For Mac, we can use Homebrew.

Command:

Example of connecting an SMTP server securely using Telnet.

Example: Testing an email with an account name Template.

Start the command prompt to input the following:

The command openssl s_client -starttls smtp -connect template.io:587 calls upon the Template server using the OpenSSL encryption protocol.

To send an unencrypted message, use the command:

begins communicating with the Template server. After hitting , you’ll receive a connection establishment message:

Add a recipient:

states the destination of our email message. Here, the Template test server sends emails. Commas can separate multiple addresses. Fill in the data and press the ENTER key. It starts with the text to send.

Followed by your text, typing Subject: will place that text in the email’s subject line. Pressing ENTER twice at the end of your subject line starts the body of the email message. Press ENTER twice at the end of the body of your text to send the email message. The message is sent to the recipient once you put a period (.) on the current line and press ENTER. Telnet works well for communicating with SMTP, but its lack of security features renders it unsuitable for use with SMTP for anything other than testing.