telnet pop很简单。在知道pop服务器路径后(例如126邮箱),打开终端,输入:
$ telnet pop.126.com 110
回车后进入pop的认证状态,输入命令
user name@domin
用户名正确返回:
+OK core mail
输入命令:
pass password
用户名正确返回:
+OK XXX message(s) [XXX byte(s)]
之后使用pop的命令来查阅邮件了。
telnet imap稍微麻烦些,我是在ubuntu上,需要stunnel提供全局的TLS/SSL 服务。
具体方法,首先安装stunnel:
$ sudo apt-get install stunnel
之后修改stunnel配置文件:/etc/default/stunnel4,将其中ENABLED=0改为ENABLED=1
修改/etc/stunnel/stunnel.conf文件如下
;====================================================================
; Sample stunnel configuration file by Michal Trojnara 2002-2006
; Some options used here may not be adequate for your particular configuration
; Please make sure you understand them (especially the effect of chroot jail)
; Certificate/key is needed in server mode and optional in client mode
;cert = /etc/stunnel/mail.pem
;key = /etc/stunnel/mail.pem
; Protocol version (all, SSLv2, SSLv3, TLSv1)
sslVersion = SSLv3
; Some security enhancements for UNIX systems - comment them out on Win32
chroot = /var/lib/stunnel4/
setuid = stunnel4
setgid = stunnel4
; PID is created inside chroot jail
pid = /stunnel4.pid
; Some performance tunings
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
;compression = rle
; Workaround for Eudora bug
;options = DONT_INSERT_EMPTY_FRAGMENTS
; Authentication stuff
;verify = 2
; Don't forget to c_rehash CApath
; CApath is located inside chroot jail
;CApath = /certs
; It's often easier to use CAfile
;CAfile = /etc/stunnel/certs.pem
; Don't forget to c_rehash CRLpath
; CRLpath is located inside chroot jail
;CRLpath = /crls
; Alternatively you can use CRLfile
;CRLfile = /etc/stunnel/crls.pem
; Some debugging stuff useful for troubleshooting
debug = 7
output = /var/log/stunnel4/stunnel.log
; Use it for client mode
client = yes
; Service-level configuration
;[pop3s]
;accept = 995
;connect = 110
[imaps]
accept = 143
connect = imap.gmail.com:993
;[ssmtp]
;accept = 465
;connect = 25
;[https]
;accept = 443
;connect = 80
;TIMEOUTclose = 0
; vim:ft=dosini
;======================================================================
这样修改后,将只能telnet gmail了,要telnet别的,请修改[imaps]下的值。
之后启动stunnel
$ sudo /etc/init.d/stunnel4 start
开启telnet:
telnet localhost 143
进入imap的认证状态(可能不叫认证状态,总之现在要用用户名密码登录邮箱了)
输入命令:
Tag name@domin password
其中,Tag是随意的值,但必须要有,具体为什么正在学习中,后面是完整的用户名,密码。
验证正确己登录邮箱了。
mark一下,下次得把pop和imap的命令贴上。好在pop的命令不多。。
telnet的imap部分翻译自http://wiredbytes.com/node/8,要翻墙,谢谢。