2011年8月2日 星期二

透過 telnet 指令測試 Mail Server POP3/IMAP/SMTP 服務

很久沒碰 Mail Service 了,結果不小心忘了測試 POP3/IMAP 用的指令,翻翻以前的 code 又回憶了起來。


筆記一下:


POP3(110/995):


> telnet mail_server_ip 110
Trying mail_server_ip...
Connected to mail_server_ip.
Escape character is '^]'.
+OK POP3 mail_server_ip 2007e.104 server ready
user UserID
+OK User name accepted, password please
pass UserPasswd
+OK Mailbox open, 11 messages
quit
+OK Sayonara
Connection closed by foreign host.


IMAP(143/993):


> telnet mail_server_ip 143
Trying mail_server_ip...
Connected to mail_server_ip.
Escape character is '^]'.
* OK [CAPABILITY IMAP4REV1 I18NLEVEL=1 LITERAL+ SASL-IR LOGIN-REFERRALS STARTTLS] mail_server_ip IMAP4rev1 2007e.404 at Tue, 2 Aug 2011 17:42:07 +0800 (CST)
- login UserID UserPasswd
- OK [CAPABILITY IMAP4REV1 I18NLEVEL=1 LITERAL+ IDLE UIDPLUS NAMESPACE CHILDREN MAILBOX-REFERRALS BINARY UNSELECT ESEARCH WITHIN SCAN SORT THREAD=REFERENCES THREAD=ORDEREDSUBJECT MULTIAPPEND] User UserID authenticated
- logout
* BYE mail_server_ip IMAP4rev1 server terminating connection
- OK LOGOUT completed
Connection closed by foreign host.


SMTP(25):


使用 UserID 和 UserPasswd 測試 (採用 echo -n UserID | base64 和 echo -n UserPasswd | base64 產生資料)
> telnet mail_server_ip 25
Trying mail_server_ip...
Connected to mail_server_ip.
Escape character is '^]'.
220 mail_server_ip ESMTP Postfix
HELO localhost.localdomain
250 mail_server_ip
AUTH LOGIN
334 VXNlcm5hbWU6
VXNlcklECg==
334 UGFzc3dvcmQ6
VXNlclBhc3N3b3JkCg==
535 5.7.8 Error: authentication failed: authentication failure
quit
221 2.0.0 Bye


加密連線:


> openssl s_client -connect mail_server_ip:port


沒有留言:

張貼留言