Telnet is an internet protocol providing command line access to servers. Telnet can be used to connect to email mail servers and send emails. This article will show you how.

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.

Connecting to a mail server

First step is to open a terminal or command line (such as powershell). Then type:

Here we connect to the MailSlurp email server but you can replace with any SMTP server. The second argument (2525) is the port. Typically, email servers run on port 25 or 2525. Use dig to lookup DNS nameservers if you don't know an SMTP server host.

Say hello!

Once connect you must say hello using the command:

If successful you will see a reply such as:

Sending a message

Mail from command

Telnet is a step-by-step process. You must instruct the server who is sending the email and to whom. Say you are sending an email to the server from, run the following command:

The server will respond with OK if it accepts your mail sender:

Rcpt To

Next you must specify the recipient of the email using .

The server will respond:

Data and subject

Next we can set the subject and the body of the message.

For the data we use the command and end our message with a new line and full stop.

What about receiving mail?

You can also read emails with telnet, provided you have login credentials. Use the and commands to login with your SMTP username and password.

List command

Use once logged in to list emails. Each email is given a number. Use the number to read each message using the command.

Retr (for retrieve)

Use to view the email by giving the number of the email that you obtained from the list.

BCC and CC

For more options see the BCC and CC SMTP guide.

Wrapping Up

In conclusion, this article has demonstrated how you can use telnet to interact directly with an SMTP server, such as MailSlurp's, enabling you to send emails, specify sender and recipient addresses, and compose messages in real-time.

MailSlurp not only serves as a reliable SMTP server for sending emails using telnet commands, but also offers additional functionalities, such as email tracking, inbox automation, and as an email generator. This comprehensive toolset makes MailSlurp an indispensable resource for developers looking to test and manage email functionality in their applications.