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 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 "//".
Windows Vista and Window 7 disable the telnet program by default. For how to enable it see other Telnet programs
MSIE 7 and above disable the telnet protocol by default. A registry edit can enable this. For a REG file, see Telnet disabled on IE7. This does not work for everyone.
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.
To download the program, click here: Trumpet Telnet (30 KB) If your browser doesn't automatically give you a Save As option, try Right click (or hold down the Shift key and click - depends on your browser) and select the Save .. As option.
Unzip the file and place the TRMPTEL.EXE file in a directory of your choice, such as C:\Windows
To start the program, just double-click the TRMPTEL.EXE file. You could also create a program icon for it. If you set it up as the Telnet program for your browser, you could also start the program via the browser using the telnet://pop-server-name:port# syntax discussed above.
If the program is started without the server name, you will be prompted to enter the Host. Enter it in the format pop-server-name:port#. For example, for Prodigy Internet, you would enter pop.prodigy.net:110
This program automatically has the Local Echo enabled, so you don't need to worry about that.
This program does not have a log to text file option. But is does have an option to log to the printer (menu item: Special, Printer On/Off). This writes directly to LPT1:, bypassing Windows.
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
代碼: 選擇全部
root@dns:/var/log# telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
+OK Dovecot ready.
USER username
+OK
PASS password
+OK Logged in.
STAT
+OK 17 1445530
LIST
+OK 17 messages:
1 19834
2 530274
3 5626
4 323583
5 11875
6 243302
7 242990
8 19875
9 27365
10 14658
11 878
12 878
13 878
14 878
15 880
16 878
17 878
.
QUIT
+OK Logging out.
Connection closed by foreign host.