Retrieving e-mail via telnet


When you check your mailbox (typically by means of an e-mail client), you are using the POP protocol. The POP protocol (Post Office Protocol) is a protocol to allow a workstation to retrieve mail that the server is holding for it. The POP protocol version 3 (POP3) is defined by the RFC 1725. The server POP listen the port 110. When the client (for example Eudora or Outlook) uses the POP3 protocol in order to retrieve e-mail messages, first it has to establish a connection to the POP3 server (port 110). Once the connection is established, the POP server send a greeting. Now the client and the server start a 'dialogue': the client ask for services to the server and the server replies. The language used by them is the POP3 protocol. Basically, this language is composed by commands. Commands consist of a keyword and one or more arguments. All commands are terminated by a CR character (carriage return) and a LF character (line feed). You can get CR and LF character simply pressing the enter key. The POP3 server's responses consist of a status indicator and a keyword. All responses are terminated by a CR character and a LF character. There are two status indicators: positive ("+OK") and negative ("-ERR").

When a connection has been opened by a client, the POP3 server issues a one line greeting, typically:

+OK POP3 server ready

Now the client must identify and authenticate itself to the POP3 server. There are 2 ways to do this job: sending a password as a plain text (user and pass commands) or sending a shared digest (using the MD5 algorithm) of a string known by the server and the client (apop command). However usually the client issues an USER command and wait for reply. If the server replies with '+OK', then the client has to provide a password by means of the PASS command. The connection is closed by means of the QUIT command. The e-mail client uses the POP3 protocol, but if you have not an e-mail client, you can start a telnet session. You have to connect to the POP3 server (port number: 110). Example of session:

C: telnet mypop3server 110
S: +OK POP3 server ready
C: USER miky
S: +OK
C: PASS secret
S: +OK miky has 2 messages (320 octets)
C: QUIT

Let's see some commands:

  • USER name (where name is your userid)
  • PASS string (where string is your password)
  • QUIT
  • LIST [msg] (where msg is the message number you want to list. If you don't provide a message number all messages will be listed)
  • RETR msg (where msg is the message number you want to retrieve)
  • DELE msg (where msg is the message number you want to delete)

Now let's see a typical session example:

S: <the server is waiting for connection on TCP port 110>
C: telnet mymailserver 110 <open connection>
S: +OK POP3 server ready
C: USER miky
S: +OK miky's has 2 messages (320 octets)
C: LIST
S: +OK 2 messages (320 octets)
C: RETR 1
S: +OK 120 octets
<the POP3 server sends message 1>
C: DELE 1
S: +OK message 1 deleted
C: QUIT
S: +OK mymailserver POP3 server signing off
C: QUIT
<close connection>
S: <the server is waiting for next connection>


Index           Home  Back       About  Contact us!

Copyright (c) 1998-2006 Wowarea