在邮件服务方面,我们可以使用TELNET服务来进行设置,进行远程监控。那么我们需要进行telnet pop的相关设置。现在就让我们一起来看看,如何使用TELNET手工操作 SMTP/POP 收发邮件的相关内容吧。
说明:手工录入的用蓝色字体表示,#后的为注释,不可录入。
- =========先计算BASE64编码的用户名密码,认证登录需要用到===========
- [crazywill@localhost crazywill]$ perl -MMIME::Base64 -e 'print encode_base64("crazywill");'
- Y3Jhenl3aWxs
- [crazywill@localhost crazywill]$ perl -MMIME::Base64 -e 'print encode_base64("mypassword");'
- bXlwYXNzd29yZA==
- ======================开始SMTP发信操作==========================
- [crazywill@localhost crazywill]$ telnet smtp.163.com 25 #telnet登录25端口
- Trying 202.108.5.81...
- Connected to smtp.163.com.
- Escape character is '^]'.
- 220 163.com Coremail SMTP(Anti Spam) System
- EHLO smtp.163.com # 握手 :)
- 250-mail
- 250-PIPELINING
- 250-AUTH LOGIN PLAIN
- 250-AUTH=LOGIN PLAIN
- 250 8BITMIME
- AUTH LOGIN # 开始认证telnet pop登录
- 334 dXNlcm5hbWU6
- crazywill
- 334 UGFzc3dvcmQ6
- mypassword
- 535 Error: authentication failed # 直接用户名密码不能登录
- AUTH LOGIN
- 334 dXNlcm5hbWU6
- Y3Jhenl3aWxs
- 334 UGFzc3dvcmQ6
- bXlwYXNzd29yZA==
- 235 Authentication successful # 使用Base64编码则成功登录
- MAIL FROM:<test@163.com> # 邮件发送方
- 553 You are not authorized to send mail, authentication is required # 不可伪造发送邮件
- MAIL FROM:<crazywill@163.com> # 邮件发送方
- 250 Mail OK
- RCPT TO:<crazywill@163.com>
- # 邮件的接收方,若有多个收件人,则重复这一语句多次。
- 250 Mail OK
- DATA # 邮件体内容
- 354 Please start mail input.
- TO: crazywill@163.com
- # 此处的TO,FROM,等内容,可以随便造假 :) 可以骗人但骗不了懂得查看邮件源码的。
- FROM: cccc@163.com
- SUBJECT: test by telnet/smtp
- test, just a test. # 邮件正文内容,与Header部分空一行开始写
- . # 邮件写完,以一个句点加回车结果。
- 250 Mail OK queued as smtp10,wKjADQ2ApxRnnqBE0CWaEw==.38326S3 # 返回250 表示发送成功。
- NOOP # 空语句,不执行任何操作,一般用来保持和服务器连接,不要掉线
- 250 OK
- QUIT # 退出
- 221 Closing connection. Good bye.
- Connection closed by foreign host.
- [crazywill@localhost crazywill]$
#p#
- =================开始POP3收信操作======================
- [crazywill@localhost crazywill]$ telnet pop.163.com 110#telnet登录110端口
- Trying 202.108.5.104...
- Connected to pop.163.com.
- Escape character is '^]'.
- +OK Welcome to coremail Mail Pop3 Server (163com[20050206])
- USER crazywill # 用户名
- +OK core mail
- PASS mypassword # 登录密码
- +OK 254 message(s) [27676669 byte(s)]
- STAT # 查看邮箱状态
- +OK 254 27676669
- LIST # 邮件列表
- +OK 254 27676669
- 1 2468
- 2 21945
- 3 33136
- 4 2071
- 5 3364
- 6 18906
- 7 3136
- 8 24764
- .................
- TOP 254 0
- #进行telnet pop设置后,查看指定邮件的邮件头,0表示查看整个邮件头,其它正整数表示限制返回多少行。
- +OK core mail
- Received: from smtp.63.com (unknown [58.252.70.158])
- by smtp5 (Coremail) with SMTP id wKjREDrA9gIfFqlEjCnRAg==.29062S4;
- Mon, 03 Jul 2006 21:07:18 +0800 (CST)
- TO: crazywill@163.com
- FROM : cccc@163.com
- # 这里即前面发信时伪造的一个假发送人信息,平时正常操作只显示这个。
- SUBJECT: test by telnet/smtp # 邮件主题
- Message-Id: <44A91687.0E6F6C.07562>
- Date: Mon, 3 Jul 2006 21:07:19 +0800 (CST)
- Sender: crazywill@163.com# 这里是真正的发送人,不可伪造。
- RETR 254 # 在telnet pop后,获取指定邮件
- +OK 354 octets
- Received: from smtp.63.com (unknown [58.252.70.158])
- by smtp5 (Coremail) with SMTP id wKjREDrA9gIfFqlEjCnRAg==.29062S4;
- Mon, 03 Jul 2006 21:07:18 +0800 (CST)
- TO: crazywill@163.com
- FROM : cccc@163.com
- SUBJECT: test by telnet/smtp
- Message-Id: <44A91687.0E6F6C.07562>
- Date: Mon, 3 Jul 2006 21:07:19 +0800 (CST)
- Sender: crazywill@163.com
- test, just a test..
- DELE 254 # 删除第254封邮件
- +OK core mail
- STAT # 查看邮箱状态
- +OK 253 27676315
- QUIT # 退出
- +OK core mail
- Connection closed by foreign host.
- [crazywill@localhost crazywill]$
- =========================================================