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 your.mailserver.com 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 smtp.voliacable.com 25
Trying 82.144.192.38…
Connected to mail.voliacable.com.
Escape character is ‘]’.
220 mail.voliacable.com ESMTP Sendmail 8.12.9/8.12.9; Thu, 6 Jan 2005 00:50:47 +0200 (EET)
mail from:saygak@voliacable.com
250 2.1.0 saygak@voliacable.com… Sender ok
rcpt to:saygak@ukr.net
250 2.1.5 saygak@ukr.net… Recipient ok
data
354 Enter mail, end with “.” on a line by itself
From:saygak@voliacable.com
To: saygak@ukr.net Subject: Test letter Test Sincerely yours, Michael . 250 2.0.0 j05Moloq006122 Message accepted for delivery
quit
221 2.0.0 mail.voliacable.com 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 freemail.ukr.net 110
Trying 212.42.65.68…
Connected to freemail.ukr.net.
Escape character is ‘]’.
+OK mPOP POP3 server ready <51152.1104965808@ukr.net>
user saygak
+OK Password required for user saygak
pass MyPassword
+OK saygak’s maildrop has 5 messages (9471 octets)
list
+OK 5 messages (9471 octets)
1 1108
2 3591
3 2701
4 1197
5 874
.
retr 5
+OK 874 octets
From saygak@voliacable.com Thu Jan 06 00:52:35 2005
Return-path:
Received: from sled.volia.net ([82.144.192.38] helo=mail.voliacable.com)
by mx-1.ukr.net with esmtp ID 1CmK15-000Ep6-9T
for saygak@ukr.net; Thu, 06 Jan 2005 00:52:35 +0200
Received: from nowhere.com (nowhere.com [10.10.10.10])
by mail.voliacable.com (8.12.9/8.12.9) with SMTP id j05Moloq006122
for saygak@ukr.net; Thu, 6 Jan 2005 00:51:45 +0200 (EET)
Date: Thu, 6 Jan 2005 00:50:47 +0200 (EET)
From: saygak@voliacable.com
Message-Id: <200501052251.j05Moloq006122@mail.voliacable.com>
X-Authentication-Warning: sled.volia.net: nowhere.com [10.10.10.10] didn’t use HELO protocol
To: saygak@ukr.net
Subject: Test letter
Test
Sincerely yours,
Michael
.
dele 5
+OK message 5 deleted
quit
+OK POP3 server at ukr.net 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.