上一篇,提到 使用telnet命令行访问邮件smtp发件服务器发送邮件 ,那如何使用telnet访问邮件收件服务器呢?在该文末,提到登录方式相同,但其实不然。

经过测试,访问腾讯企业邮件,确实可以通过auth login来登录:

1
2
3
4
telnet pop.exmail.qq.com 110
auth login
xxx
xxx

但我们发现访问我们自建的james服务器则不行,而需要使用下面命令形式来登录:

1
2
3
4
USER user1
+OK
PASS pass1
+OK Welcome user1

说明:

上述示例user1不带邮箱后缀,可能与服务器邮箱设置有关,pass1是密码明文。

POP3命令详细说明:

Command Description Example
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
+OK Bye-bye.
STAT Returns total number of messages and total size STAT
+OK 2 320
LIST Lists all messages LIST
+OK 2 messages (320 octets)
1 120
2 200
LIST 2
+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
+OK
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
+OK
***