Command-Line

使用終端檢查彈出郵件帳戶

  • May 7, 2015

unix 中是否有任何命令可以使用終端檢查 pop3 帳戶?我的意思是,輸入 pop3 帳戶的伺服器/使用者名/密碼,看看使用者名/密碼是否正確?

您可以使用telnet連接到郵件伺服器並使用POP3來檢查您的憑據:

$ telnet pop.gmx.net 110
Trying 212.227.17.185...
Connected to pop.gmx.net.
Escape character is '^]'.
+OK POP server ready H migmx028 0MAbjW-1YwF4D0ml8-00BiVl
USER spamaccount80@gmx.de
+OK password required for user "spamaccount80@gmx.de"
PASS typeyourpassword
-ERR Error retrieving your GMX emails. Your connection is not encrypted. Enable SSL in your mail program. Instructions: https://ssl.gmx.net
Connection closed by foreign host.

好吧,這失敗了,因為現在大多數郵件伺服器都需要SSL/TLS 加密會話telnet因此,您可以使用以下命令代替使用socat

$ socat - OPENSSL:pop.gmx.net:995
+OK POP server ready H migmx113 0MC062-1Yzese0KO7-00AVNE
USER spamaccount80@gmx.de
+OK password required for user "spamaccount80@gmx.de"
PASS typeyourpassword
+OK mailbox "spamaccount80@gmx.de" has 13518 messages (191718918 octets) H migmx113

如果你輸入了錯誤的密碼,伺服器可能會這樣說:

-ERR authentication failed

或者,socat您可能會openssl四處閒逛:

$ openssl s_client -quiet -connect pop.gmx.net:995
depth=2 C = DE, O = Deutsche Telekom AG, OU = T-TeleSec Trust Center, CN = Deutsche Telekom Root CA 2
verify error:num=19:self signed certificate in certificate chain
verify return:0
+OK POP server ready H migmx108 0MWpjO-1YiwnK3ZfP-00XoK

引用自:https://unix.stackexchange.com/questions/201818