文章

关于TCP端口25与110的一些认识

大家知道可以通过TELNET登录到邮件服务器的110与25号端口进行收发邮件的
工作,这两个是默认的POP3与SMTP的TCP端口。但是很难找到有关这两个端口命令的详细资料。当连接到端口25时,通常会
有:(注意如果用Win95/98的telnet来连接,应该选中终端->首选->本地响应,因为服务器端是不回显的。)

220 Welcome message ...

输入HELP可以得到一些帮助信息:

help

214-This is Sendmail version 8.9.2

214-Topics:

214- HELO EHLO MAIL RCPT DATA

214- RSET NOOP QUIT HELP VRFY

214- EXPN VERB ETRN DSN

214-For more info use "HELP ".

214-To report bugs in the implementation send email to

214- sendmail-bugs@sendmail.org.

214-For local information send email to Postmaster at your site.

214 End of HELP info

可以看到这是一个流行的SMTP服务软件Sendmail,版本是8.9.2。

通常的发送邮件命令顺序为:

MAIL FROM:"Dallas Thunder"

250 "Dallas Thunder"... Sender ok

RCPT TO:"Dallas Thunder"

250 "Dallas Thunder"... Recipient ok

DATA

354 Enter mail, end with "." on a line by itself

subject:First hello

Hi, this is a test

..

250 OAA06479 Message accepted for delivery  

这封邮件就已经排队待发了,对用户来说等于已经发出。至于连接到端口110就更可气了,我用的这个居然连help也不支
持,只能靠瞎猜得到了这么一些用法。连通后先是欢迎信息:

+OK Welcome message...

然后输入用户名和密码进入:

USER dallas

+OK Password required for dallas.

PASS password

+OK dallas has 2 messages (2961 octets).

LIST

+OK 2 messages (2961 octets)

1 1338

2 1623

..

怎么列出邮件的Subject我可不知道。读邮件输入:

RETR 1

+OK Message follows

(然后是邮件的源代码,MIME信息需要e-mail客户软件来处理,开头是一堆路由信息)

Received: from smtp.szonline.net (webmail.szonline.net [202.96.154.33])

by szonline.net (8.9.2/8.9.2) with ESMTP id PAA21264

for ; Wed, 9 Jun 1999 15:05:17 +0800 (CST )

Received: from public1.szptt.net.cn (public1.szptt.net.cn [202.96.134. 166])

by smtp.szonline.net (8.9.3/8.9.3) with ESMTP id PAA01629;

Wed, 9 Jun 1999 15:04:39 +0800 (CST)

Received: from SZ-SVR-2.sz.gnet.gd.cn (SZ-SVR-2.sz.gnet.gd.cn [172.21. 16.86])

by public1.szptt.net.cn (8.9.2/8.9.2) with ESMTP id PAA22717;

Wed, 9 Jun 1999 15:05:02 +0800 (CST)

Received: from b0505a ([172.21.79.28])

by SZ-SVR-2.sz.gnet.gd.cn (8.9.2/8.9.2) with SMTP id PAA10622;

Wed, 9 Jun 1999 15:02:50 +0800 (CST)

Message-ID: <004801beb246$f0396260$4400080a@b0505a>

From: "Dallas Thunder"

To: "Dallas Thunder"

Subject: First hello

Date: Wed, 9 Jun 1999 15:08:55 +0800

MIME-Version: 1.0

X-Priority: 3

X-MSMail-Priority: Normal

X-Mailer: Microsoft Outlook Express 5.00.2014.211

X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211

Content-Transfer-Encoding: 8bit

X-MIME-Autoconverted: from base64 to 8bit by szonline.net id PAA21264

Content-Type: text/plain;

charset="gb2312"

X-UIDL: '1)e9pe-e9WP`!!T4%e9

Status: U

Hi, this is a test.

如果从服务器中删除邮件,则输入:

DELE 1 +OK Message 1 has been deleted.

e-mail的客户程序通常都有一个选项“将邮件的副本留在服务器”,如果没有选中这一项那么客户程序会在接收完所有邮
件后执行DELE命令,如果选中则不执行。

最后是退出:

QUIT +OK Pop server at szonline.net signing off.  
可见发送邮件不需要身份验证,为了防止垃圾邮件泛滥,现在很多的SMTP服务器都采取了限制收发一方的手段,也就是说
收或发的至少一方必须是本网用户才可以发送邮件,否则会得到一个550或者553的出错信息。

以上信息纯属本人摸索得出,见笑方家。如有错漏,欢迎指正。