POP3 Protocol using Telnet

What is POP3?

POP3 (Post Office Protocol Version 3) is an Internet Protocol used by Internet Service Providers (ISP) which permits to retreive e-mails from a mail server. It is described in RFC1939. This service is using the TCP protocol, port 110.

What is this page for?

With e-mail clients, you may expect problems to get your mail, for example if you have received a big e-mail you’d like to delete, want to test an account quickly, look intelligent, or if you have any other reason to check a mailbox.

The Protocol

This assumes that you have a telnet client and you know how to run it.

You have to connect to the POP3 service of your (ISP’s) mail server : telnet pop.isp.com 110 under UNIX systems, if the connection is successful, you’ll get a greeting message. At this point you have to send a command to the server, which is answered by +OK for a positive answer or -ERR in any other case.


Before being able to read and/or erase your e-mails, you have to authenticate to the server. There are 2 commands for this which must be followed : USER and PASS. Example of authentication:

$ telnet pop.eo.lu 110
Connected to unicorn.europeonline.net.
Escape character is '^]'.
+OK Europe Online Mail Server.
USER rewt
+OK rewt selected
+OK Congratulations!
+OK blah blah

This means that the account exists and the password is valid. The QUIT command tells the server that you want to stop the connection.

Get/delete e-mails

Once authenticated, you can have some info about your e-mails, fetch some or delete some. Some POP3 commands will be quickly described from now:


The STAT commands tell about the mailbox content briefly:

+OK 2 2206

This output shows that there are two messages in the mailbox, and their size is 2206 bytes. It doesn’t say about each message size. In order to know which message takes what space, you’ll have to use the LIST command:


+OK 2 messages (2206 octets)
1 1273
2 933

OK, I hope you understood that there are 2 messages received, size of the first is 1273 bytes, and second is 933 bytes.

Retreive your mail, with RETR and TOP

You can use these 2 commands to fetch your e-mail, the 1st gets the whole e-mail you requested, and the 2nd displays the header and the number of lines you asked to see from the message’s body. Anyway, you should consider that there are some ISPs who delete e-mails from the mail server when you retreived them, so if you’re not sure about it, use the TOP command. RETR requests as argument the e-mail number you’d like to fetch, and TOP requests the same and the number of line you would like to see. Here is an example:

+OK 1273 octets
< the POP3 server sends the entire message here >
TOP 1 5
+OK 1273 octets
< the POP3 server sends the headers of the message, a blank line, and the first 5 lines of the body of the message >

The TOP command is useful to see the content is big e-mails.

Delete E-mail

You have to use the DELE command. The syntax is the same as RETR. (DELE 4 to delete the fourth message in the INBOX).

5 thoughts on “POP3 Protocol using Telnet”

  1. Nice content with nice example and explanation, but there are even more POP commands, why cant u publish here…..!

  2. Great post, helped a lot. Thank you!

    To Cybercrawler: of course there are more POP3 commands, the point of the article was to allow you to read your mail using telnet, it showed how simple it is and how simple it is to write an application to fetch your mail. This page is a good place to start learning about POP3.

  3. Hi shekar,

    Actually, this is the job of the email client, but you can find those in the email headers; for example:

    retr 158
    +OK 28277 octets
    Received: from cvs.openbsd.org (localhost [])
    by cvs.openbsd.org (8.14.5/8.12.1) with ESMTP id q41EkHrX005568
    (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO);
    Tue, 1 May 2012 08:46:17 -0600 (MDT)
    Received: (from beck@localhost)
    by cvs.openbsd.org (8.14.5/8.12.0/Submit) id q41EkHTj023842;
    Tue, 1 May 2012 08:46:17 -0600 (MDT)

    Date: Tue, 1 May 2012 08:46:17 -0600 (MDT)
    Message-Id: <201205011446.q41EkHTj023842@cvs.openbsd.org>
    From: Bob Beck
    To: announce@openbsd.org, misc@openbsd.org, tech@openbsd.org
    Subject: OpenBSD 5.1 released May 1, 2012

    X-Loop: announce@openbsd.org
    Precedence: list
    Sender: owner-announce@openbsd.org

    – OpenBSD 5.1 RELEASED ————————————————-


    From this, you can write an email client 😉

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

New day, new adventure