这是一个用telnet连接上邮件服务器发邮件的过程. 蓝色部分都是我输入的命令或者参数.
AUTH LOGIN后的用户名及密码是base 64编码的, 即把用户名和密码都用base 64编码,就可以了。
RCPT TO:要指定一个接收者,该邮箱必须存在。
后面的邮件的To:就可以是任何邮件地址了。To:和RCPT TO:不一样会让接收者很纳闷。邮件结束的时候是一个回车加一个点加一个回车, 即<CRLF>.<CRLF>
注意,这种邮件的格式是Plain text. 没有很复杂的东西。
[lijie@hostname ~]$ telnet 10.129.10.17 25
Trying 10.129.10.17...
Connected to exchangeserver (10.129.10.17).
Escape character is '^]'.
220 exchangeserver Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at Mon, 31 May 2010 16:16:11 +0800
EHLO myhost
250-exchangeserver Hello [10.129.15.92]
250-TURN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM LOGIN
250-X-EXPS=LOGIN
250-AUTH GSSAPI NTLM LOGIN
250-AUTH=LOGIN
250-X-LINK2STATE
250-XEXCH50
250 OK
AUTH LOGIN
334 VXNlcm5hbWU6
bIGlqrEaWU=
334 UGFzc3dvcmQ6
Yu76ijUeSYmMndzeA==
235 2.7.0 Authentication successful.
MAIL FROM: test@test.net
250 2.1.0 test@test.net....Sender OK
RCPT TO: xxx@xxx.com
250 2.1.5 xxx@xxx.com
data
354 Start mail input; end with <CRLF>.<CRLF>
From: test1@domain.com
To: test2@domain.com
Date: Mon, 25 Oct 2004 14:24:27 +0800
Subject: test mail
Hi, test2
This is a test mail, you don't reply it.
.
250 2.6.0 <PEXHM3SOlbp000001b6@exchangeserver> Queued mail for delivery
quit
221 2.0.0 exchangeserver Service closing transmission channel
Connection closed by foreign host.