The POP3 (Post Office Protocol Version 3) is an application-layer Internet standard protocol used by local Email clients to retrieve Email from a remote server over a TCP/IP connection.
This tutorial shows how to connect to POP3 mail server and manage incoming Email using the ‘telnet’ command.
Step 1: Open a connection from your computer to a POP3 mail server
$ telnet pop.domain.ext 110 Trying ???.???.???.???... Connected to pop.domain.ext. Escape character is '^]'. +OK ready
- pop.domain.ext – Your mail server;
- 110 – Default port for POP3.
Step 2: Type your Login
> USER username +OK Password required for UserName.
Step 3: Type your Password
> PASS password +OK username has ? visible messages (? hidden) in ????? octets.
POP3 Commands with Description
Here are the basic POP3 commands, that you can use to manage your incoming Email.
|USER [username]||1st login command||USER Stan
+OK Please enter a password
|PASS [password]||2nd login command||PASS SeCrEt
+OK valid logon
|QUIT||Logs out and saves any changes||QUIT
|STAT||Returns total number of messages and total size||STAT
+OK 2 320
|LIST||Lists all messages||LIST
+OK 2 messages (320 octets)
+OK 2 200
|RETR [message]||Retrieves the whole message||RETR 1
+OK 120 octets follow.
|DELE [message]||Deletes the specified message||DELE 2
+OK message deleted
|NOOP||The POP3 server does nothing, it merely replies with a positive response.||NOOP
|RSET||Undelete the message if any marked for deletion||RSET
+OK maildrop has 2 messages (320 octets)
|TOP [message] [number]||Returns the headers and number of lines from the message||TOP 1 10
3 Replies to “HowTo: Retrieve Email from a POP3 Server using the Command Line”
Oh man, I haven’t done this in 20 years. I would actually be surprised to see telnet actually installed on a server these days.
Use netcat, then
For those TLS/SSL-secured POP3-Servers, you could use
openssl s_client -connect pop.example.net:995
And then continue with the commands above. I had fun with the exercise, thanks. 🙂