Using Telnet with a POP3 Mail Server

A Tutorial by Michael Santovec


It is possible, with many ISPs, to use a Telnet program to do maintenance on your mailbox on the POP3 mail server. This allows you to look at, and possibly delete, any problem causing message (e.g. too large to download, improperly formatted message, etc.)

The instructions below are based on the Win95 TELNET.EXE program. See here for some other Telnet programs and operating systems.

From the Win95 task bar, select: Start, Run..., and enter the following:
telnet pop-server-name port#
(Note: if you start Telnet from the browser, rather than the Win95 Start Run command, the syntax is telnet://pop-server-name:port# - However, MSIE 3 has a bug and you must leave out the // on the address line and use telnet:pop-server-name:port#)

Check your mail settings for the pop-server-name and port#. Most POP3 servers use port 110.

For example:
 - For BTInternet:  telnet mail.btinternet.com 110
 - For AT&T:        telnetpop.att.yahoo.com 110
 - For Comcast:     telnetmail.comcast.net 110

This will connect to the mail server. If you fail to get a successful connection message, check the following:
You will want to enable Local Echo so you can see what you type. In the Win95 Telnet program this is under Terminal, Preferences. Also, you may want to turn on logging to capture messages to a text file. In the Win95 Telnet program this is under Terminal, Start Logging

For command line version telnet clients, you can usually enter help at the telnet prompt to get a list of commands. For example, set localecho may be used to turn on local echo.

For the connection, and each command that you enter, the mail server will respond:
-ERR 999 message text
for commands it doesn't like (the 999 is an optional error code that varies), or
+OK message text
if it likes the command. After each response, you can enter a new command.

Note: When entering the following commands to the POP3 server, you may not be able to use the backspace key to fix typing errors. Many POP3 servers do not recognize that. They aren't expecting a person, but rather another program that doesn't make typing mistakes. For example, if you key "STS(bs)AT" (where (bs) represents the backspace key), you may see "STAT", but the POP3 server lilely will report that "STAT" is an unknown command. That's because the server saw "STS(bs)AT". If you make a typing error, just hit Enter, let the server report the error, and start the command again. However, if you make a mistake on the USER or PASS command, you won't likely get a second chance. In that case, enter the QUIT command and start the Telnet program over.

Commands that you can/must use are:

USER userid
This must be the first command after the connect. Supply your e-mail userid (this may or may not not the full e-mail address). Example: USER john.smith

PASS password
This must be the next command after USER. Supply your e-mail password. The password may be case sensitive.

The following commands may be used as needed:

STAT
The response to this is: +OK #msgs #bytes Where #msgs is the number of messages in the mail box and #bytes is the total bytes used by all messages. Sample response: +OK 3 345910

LIST
The response to this lists a line for each message with its number and size in bytes, ending with a period on a line by itself. Sample response:
+OK 3 messages
1 1205
2 305
3 344400
.

RETR msg#
This sends message number msg# to you (displays on the Telnet screen). You probably don't want to do this in Telnet (unless you have turned on Telnet logging). Example: RETR 2

TOP msg# #lines
This is an optional POP3 command. Not all POP3 servers support it. It lists the header for msg# and the first #lines of the message text. For example, TOP 1 0 would list just the headers for message 1, where as TOP 1 5 would list the headers and first 5 lines of the message text.

DELE msg#
This marks message number msg# for deletion from the server. This is the way to get rid a problem causing message. It is not actually deleted until the QUIT command is issued. If you lose the connection to the mail server before issuing the QUIT command, the server should not delete any messages. Example: DELE 3

RSET
This resets (unmarks) any messages previously marked for deletion in this session so that the QUIT command will not delete them.

QUIT
This deletes any messages marked for deletion, and then logs you off of the mail server. This is the last command to use. This does not disconnect you from the ISP, just the mailbox.

There are other POP3 commands. For some more information on this topic, see:

RFC 1939 which defines POP3 commands and error codes

How to Enable and Interpret the Pop3.log File article, which is specific to the Microsoft Internet Mail program (the logging only works with that program), but it provides general information on what goes on with a POP3 mail server.

For additional help, information and resources, see my ?Technical Help page.


Top of page Top of section

Other Telnet Programs

The above instructions are based on the Win95 TELNET.EXE program. Other Telnet programs also work. However, it is necessary to use a non-standard Telnet port number which some Telnet programs may have problems with. How you start the Telnet program, and enter the POP3 server name and port number will depend on your operating system and the particular Telnet program.

For Windows Vista and Windows7, telnet is disabled by default. To enable it: Click the Start button , click Control Panel, and then click Programs. Under Programs and Features, click Turn Windows features on or off. (If you are prompted for an administrator password or confirmation, type the password or provide confirmation). In the Windows Features dialog box, select the Telnet Client check box. Click OK.

For Win3.1, Trumpet Telnet is a free tiny and easy to use program that works with POP3 servers. For Mac and OS/2, if you don't have a Telnet program, check out TUCOWS. You can also check out the Software section of my Technical Help page. There you can search a number of sites for freeware or shareware Telnet clients.


Top of page Top of section

Last updated: 2010-04-10