Working With E-mail Using Telnet

By | July 11, 2008

We often send and receive e-mails. Thanks to spammers, we do more receive mail than send it, but it is not the glue. We usually use e-mail clients that are negotiating with POP3 (IMAP) and SMTP servers. Though IMAP is more secure, POP3 is much simpler and you can find it anywhere. But… let’s imagine your e-mail client like Microsoft Outlook or The Bat! disappeared from your PC and you need to send and receive your e-mails. I will show you how to do it using telnet.

In order to connect to your mail server (I’ll start with SMTP server) you neet to know its address and port that is used if it is not standard. Usually it should be 25, but some administrators set up other ports to ensure protection. We’ll suppose we have a mail server that is accepting requests at port 25. So in order to connect to it we need to enter the following command:

telnet 25

This will open a telnet session to your server. Then I’ll show you the complete log of sending an e-mail – it is quite clear and you can see the commands entered. I found it here

telnet 25
Connected to
Escape character is ‘]’.
220 ESMTP Sendmail 8.12.9/8.12.9; Thu, 6 Jan 2005 00:50:47 +0200 (EET)
250 2.1.0… Sender ok
250 2.1.5… Recipient ok
354 Enter mail, end with “.” on a line by itself
To: Subject: Test letter Test Sincerely yours, Michael . 250 2.0.0 j05Moloq006122 Message accepted for delivery
221 2.0.0 closing connection
Connection closed by foreign host.

All entered commands are highlighted in bold. We need to specify mail from – sender address, rcpt to – recipient address and data: the text itself with all the necessary headers that should be located within data before the ending dot.

Another example will illustrate how to receive an e-mail using telnet:

telnet 110
Connected to
Escape character is ‘]’.
+OK mPOP POP3 server ready <>
user saygak
+OK Password required for user saygak
pass MyPassword
+OK saygak’s maildrop has 5 messages (9471 octets)
+OK 5 messages (9471 octets)
1 1108
2 3591
3 2701
4 1197
5 874
retr 5
+OK 874 octets
From Thu Jan 06 00:52:35 2005
Received: from ([]
by with esmtp ID 1CmK15-000Ep6-9T
for; Thu, 06 Jan 2005 00:52:35 +0200
Received: from ( [])
by (8.12.9/8.12.9) with SMTP id j05Moloq006122
for; Thu, 6 Jan 2005 00:51:45 +0200 (EET)
Date: Thu, 6 Jan 2005 00:50:47 +0200 (EET)
Message-Id: <>
X-Authentication-Warning: [] didn’t use HELO protocol
Subject: Test letter
Sincerely yours,
dele 5
+OK message 5 deleted
+OK POP3 server at signing off
Connection closed by foreign host.

I think that everything is clear – we are connecting to a POP3 server, authenticating, getting the fifth message for reading and then delete it.

All SMTP commands are described at RFC 821 and POP3 specification may be found here: RFC 1725.