命令行邮件测试方法
1、Base64 编码的生成
# perl -MMIME::Base64 -e 'print encode_base64("root\@test.net");'
cm9vdEB0ZXN0Lm5ldA==
# perl -MMIME::Base64 -e 'print encode_base64("000000");'
MDAwMDAw
2、测试发送邮件(端口:25):
mail# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 0.
Escape character is '^]'.
220 mail.test.net ESMTP Postfix
ehlo mail
250-mail.test.net
250-PIPELINING
250-SIZE 4194304
250-VRFY
250-ETRN
250-AUTH NTLM LOGIN PLAIN OTP
250-AUTH=NTLM LOGIN PLAIN OTP
250 8BITMIME
auth login
334 VXNlcm5hbWU6
cm9vdEB0ZXN0Lm5ldA== //用户名id:root@test.net
334 UGFzc3dvcmQ6
MDAwMDAw //用户密码password:000000
235 Authentication successful
MAIL FROM:<root@test.net> //告诉服务器发件人的Email地址
250 Ok
RCPT TO:<root@test.net> //告诉服务器收件人的地址
250 OK
DATA //告诉服务器开始写信
354 End data with .
SUBJECT:test //subject后面填写的是邮件的主题
test
. //换行后输入.后按回车,表示信件内容书写完毕
250 Ok: queued as 58DC71D5
quit //发送信件,结束对话,退出SMTP服务器
221 Bye
Connection closed by foreign host
3、测试收取邮件(端口:110):
mail# telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to 0
Escape character is '^]'
+OK Hello there
user root@test.net
+OK Password required
pass 000000
+OK logged in
list
+OK POP3 clients that break here, they violate STD53
1 2217
retr 1 //返回第一封信的全部内容
+OK 2217 octets follow.
Return-Path: <root@test.net>
X-Original-To: root@test.net
Delivered-To: root@test.net
Received: from mail (localhost.test.net [127.0.0.1])
by mail.test.net (Postfix) with ESMTP id 58DC71D5
for <root@test.net>; Mon, 9 Aug 2013 21:11:20 +0800 (CST)
SUBJECT:test
Message-Id: <20130809131120.58DC71D5@mail.test.net>
Date: Mon, 9 Aug 2013 21:11:20 +0800 (CST)
From: root@test.net
To: undisclosed-recipients:;
test
.
dele 1 //删除
+OK Deleted
quit
+OK Bye-bye
Connection closed by foreign host