免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 3548 | 回复: 10
打印 上一主题 下一主题

大家有看过sendmail代码的吗? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-07-14 13:02 |只看该作者 |倒序浏览
想自己写一个邮件客户端,连接邮件服务器发信。 在有的文章说明邮件服务器端可以限定通过它转发出去的主机,比如可以限定 某个子网段的用户,和属于某个域的用户。我的问题是 服务器端是怎么知道客户端属于哪个域呢?谢谢 大家

论坛徽章:
0
2 [报告]
发表于 2007-07-14 13:28 |只看该作者
看懂ESMTP协议就行了。不用看sendmail

论坛徽章:
0
3 [报告]
发表于 2007-07-14 13:41 |只看该作者
我觉得这个和 服务器配置有关,所以我想知道sendmail是在 交互过程中哪一步过滤掉的?

EHLO HOSTNMAE 这一步么?

论坛徽章:
0
4 [报告]
发表于 2007-07-14 14:37 |只看该作者
原帖由 toplin8 于 2007-7-14 13:41 发表
我觉得这个和 服务器配置有关,所以我想知道sendmail是在 交互过程中哪一步过滤掉的?

EHLO HOSTNMAE 这一步么?


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

域是反查出来的.一般现在都关闭反查,限定relay一般都通过IP来限制了.

论坛徽章:
0
5 [报告]
发表于 2007-07-14 14:44 |只看该作者
谢谢 老大
能继续说下  服务器反查域 的过程么?
是通过什么协议呢?

论坛徽章:
0
6 [报告]
发表于 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 的参数进行限制?

论坛徽章:
0
7 [报告]
发表于 2007-07-14 15:24 |只看该作者
我搜索了下

应该用 gethostnamebyaddr()就可以了?

论坛徽章:
0
8 [报告]
发表于 2007-07-14 21:05 |只看该作者

回复 #7 toplin8 的帖子

gethostbyaddr()

这个需要dns服务器支持ip->host 查询的,

论坛徽章:
0
9 [报告]
发表于 2007-07-14 22:48 |只看该作者
个人不建议读sendmail的。sendmail相对来说年头比较久了,代码可能维护的也不是很理想(个人意见),比如有些函数一千多行,看起来很迷糊。
个人推荐qmail的代码。

论坛徽章:
0
10 [报告]
发表于 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 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP