Jameser's Tech Tips

Tuesday, June 27, 2006

Tip #1: Checking POP3 Mail via Telnet

This is tip #1 of what I hope to be many... I'll try to add at least one per day, so please check back frequently for new postings...

Scenario: You are not at your main PC and need to check your POP3 mail... Granted there are websites which allow you to check your POP3 account via your browser, but that's just kind of taking the easy way out, and you may not trust some random webserver with your POP3 password...

With this technique, you'll be able to check your mail from pretty much any internet connected PC...

First open a command prompt on a Windows box (Start/Run/cmd), or open a shell on your linux box...

Next step is to connect to your POP3 via telnet using the following command:
C:\> telnet pop.yourmailserver.com 110
It is important to not leave off the 110, otherwise you'll be connecting to the server's telnet port (which shouldn't be open anyway)...

Once connected, you'll receive a prompt similar to the following:
+OK
That's it... That's all it will say, "+OK"... If you don't get this response, perhaps you have the server name incorrect, or neglected to add the port 110 at the end of your command...

Okay, now that we're connected, we'll need to let the server know who we are, via the following command:
USER yourusername (then hit ENTER)
You should then be greeted again with the ambiguous "+OK" prompt...

Next, we need to authenticate with the server, using the following command:
PASS yourpassword (then hit ENTER)
You should again receive the "+OK" prompt... Notice that your password is visible through this method, so you may want to hit ENTER a few times so it scrolls off the top of you screen... (You'll get -ERR prompts if you do , but they should not affect this process...)

Okay, now you're connected to your mail server, so let's proceed to check our mail... The following commands allow you get information on the number of messages you have waiting, as well as retrieving all or part of each messages content...

First, let's see what we have waiting for us with the following command:
STAT (then hit ENTER)
This command will give you the statistics for your POP3 box... The format is:
+OK 33 245667
The +OK means the server acknowledged your request, the 33 is the number of your messages waiting on the server, and the 245667 is the total number of bytes for all of your messages...

LIST (then hit ENTER)
This command will list all of the messages waiting in your account, and also display the size of the message. Example output:
+OK
1 2344
2 4567
The first number is the number of the message, and the last number is the size of the message...

Now let's take a look at one of our e-mails...
TOP 1 5 (then hit ENTER)
This command tells the server to display the first 5 lines of message #1... The header for the message will also be displayed so you can determine its origin...

Now, let's say we want to read the entire message for message #1... Use the following command:
RETR 1 (then hit ENTER)
The entire contents of message #1 will be displayed...

Okay, let's delete a message now... Use this command:
DELE 1 (then hit ENTER)
The message should now be deleted from the server...

Once you have checked your mail, you may now exit the POP3 session by issuing a QUIT command...
QUIT (then hit ENTER)
This should drop you back to your command prompt...

These are basically the same your steps any mail client uses to access, display, and retrieve mail from a POP3 server, and now you should be able to achieve the same results from any machine and any location...

Please leave comments if you have any ?'s...

2 Comments:

  • At 6/28/2006 2:19 PM, Blogger Jameser said…

    Unfortunately not... The POP3 protocol was developed and finalized in the 1990s when security was not as much a concern as it is today... Most POP3 servers still transmit your password and messages in clear text over the internet... There are some recent enhancements to try to help secure POP3, like SPA (Secure Password Authentication) and POP3 over SSL using port 995, but a basic POP3 connection as outlined in this article is not encrypted or protected in any way...

    If you have SSH access to the POP3 mail server, you could log in over SSH and then use a command line mail app on the server, but most providers aren't likely to hand out SSH access to their mail users... If it's your server though, connecting via SSH _would_ be the best approch...

    Thanks for the comment...

    James...

     
  • At 11/04/2007 5:47 AM, Anonymous Anonymous said…

    if you want to access a POP3 account over SSL (and are using linux) connect with

    openssl s_client -connect yourPOP3Server:995

     

Post a Comment

<< Home