Friday, July 20, 2007

Using Telnet with a POP3 Mail Server

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 CNZX Internet: telnet 110
- For AT&T Worldnet: telnet 110
- For Netcom: telnet 110
- For SpryNet: telnet 110
(# is 1 to 5 and varies by user)

This will connect to the mail server. If you fail to get a successful connection message, check the following:
You must include the correct port number, usually 110. The default Telnet port number won't work.
The syntax varies by how you start the Telnet program. On the Start, Run, you separate the server name and the port number with a Space. In the browser, you separate the server name and the port number with a Colon.
If starting from the browser, the browser must be configured to know about your Telnet program. The Win95 version of MSIE normally does this automatically on install. For Netscape, and the Win3.1 version of MSIE you usually need to do this manually. See your browser documentation. However, it is not necessary to start the program from the browser. You can start it directly.
MSIE 3 may not start the Telnet program from its address line if you use the "//" in the URL. Just remove the "//".
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 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) recodesents 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 (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:

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

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

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

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 Intercodet 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.

No comments:

Post a Comment