Chinaunix

标题: 大家有看过sendmail代码的吗? [打印本页]

作者: toplin8    时间: 2007-07-14 13:02
标题: 大家有看过sendmail代码的吗?
想自己写一个邮件客户端,连接邮件服务器发信。 在有的文章说明邮件服务器端可以限定通过它转发出去的主机,比如可以限定 某个子网段的用户,和属于某个域的用户。我的问题是 服务器端是怎么知道客户端属于哪个域呢?谢谢 大家
作者: doctorjxd    时间: 2007-07-14 13:28
看懂ESMTP协议就行了。不用看sendmail
作者: toplin8    时间: 2007-07-14 13:41
我觉得这个和 服务器配置有关,所以我想知道sendmail是在 交互过程中哪一步过滤掉的?

EHLO HOSTNMAE 这一步么?
作者: hightman    时间: 2007-07-14 14:37
原帖由 toplin8 于 2007-7-14 13:41 发表
我觉得这个和 服务器配置有关,所以我想知道sendmail是在 交互过程中哪一步过滤掉的?

EHLO HOSTNMAE 这一步么?


当然不是ehlo或helo这一步了!!这个只是一个打招呼协议,后面你爱写什么都无所谓

域是反查出来的.一般现在都关闭反查,限定relay一般都通过IP来限制了.
作者: toplin8    时间: 2007-07-14 14:44
谢谢 老大
能继续说下  服务器反查域 的过程么?
是通过什么协议呢?
作者: toplin8    时间: 2007-07-14 14:50
xxfi_helo
SYNOPSIS #include <libmilter/mfapi.h>
sfsistat (*xxfi_helo)(
        SMFICTX * ctx,
        char * helohost
);

Handle the HELO/EHLO command.  
DESCRIPTION Called When xxfi_helo is called whenever the client sends a HELO/EHLO command. It may therefore be called several times or even not at all; some restrictions can be imposed by the MTA configuration.  
Default Behavior Do nothing; return SMFIS_CONTINUE.

ARGUMENTS Argument Description
ctx Opaque context structure.  
helohost Value passed to HELO/EHLO command, which should be the domain name of the sending host (but is, in practice, anything the sending host wants to send).  


--------------------------------------------------------------------------------
Copyright (c) 2000, 2003, 2005 Sendmail, Inc. and its suppliers. All rights reserved.
By using this file, you agree to the terms and conditions set forth in the LICENSE.


这个是我在sendmail官方网站查到的一点信息  连接是

http://www.sendmail.org/doc/send ... docs/xxfi_helo.html


里面的Handle the HELO/EHLO command.  
DESCRIPTION Called When xxfi_helo is called whenever the client sends a HELO/EHLO command. It may therefore be called several times or even not at all; some restrictions can be imposed by the MTA configuration.  
好像说 可以通过 对 HELO/EHLO 的参数进行限制?
作者: toplin8    时间: 2007-07-14 15:24
我搜索了下

应该用 gethostnamebyaddr()就可以了?
作者: fxl02    时间: 2007-07-14 21:05
标题: 回复 #7 toplin8 的帖子
gethostbyaddr()

这个需要dns服务器支持ip->host 查询的,
作者: monnand    时间: 2007-07-14 22:48
个人不建议读sendmail的。sendmail相对来说年头比较久了,代码可能维护的也不是很理想(个人意见),比如有些函数一千多行,看起来很迷糊。
个人推荐qmail的代码。
作者: monnand    时间: 2007-07-14 22:50
我读qmail的时候写了这个东西:
http://blog.csdn.net/monnand/archive/2006/07/15/924731.aspx
(由于csdn那边有点问题,那篇文章的第一个插图可能有错,正确的在附件里面


不知道LZ有没有用,拿来顺便广告一下

[ 本帖最后由 monnand 于 2007-7-14 22:53 编辑 ]
作者: toplin8    时间: 2007-07-16 22:14
非常感谢。

那衍生个话题: 主机是怎么把域名注册到DNS服务器上的呢?




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2