Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网站建设 > 服务器相关 > Postfix: header/body checks using MySQL
【标  题】:Postfix: header/body checks using MySQL
【关键字】:Postfix,header/body,checks,using,MySQL
【来  源】:http://www.cublog.cn/u/364/showart.php?id=68362

Postfix: header/body checks using MySQL

Your Ad Here

Postfix: header/body_checks using MySQL (zt)


转载自某邮件列表,回复者比较透彻的说明了postfix中各种map方式的机制及使用方法

On 20 July 2000, Stephen Bolinger <pflist@pigglet.com> wrote:
> >> Is it possible to have all of my header/body checks in a mysql
> >> table? If it is, how is it called?
> >>
> >> header_checks = mysql:/etc/postfix/header_checks.mysql ???
> >>
> >> If I specify it like this, will it still interpret regular
> >> expression returned from the lookup? Or will it only match
> >> absolutely?
>
> >In order to subject header/body lines to regular expressions, specify
> >a map type that supports regular expressions.
> >
> > Wietse
>
> Does anyone know if mysql supports regular expressions? I have the
> line below working in an absolute matching fashion, but not as regexp:
> header_checks = mysql:/etc/postfix/header_checks.mysql
>
> This checks the database and searches the header for an exact literal
> match, so if I have "/^Subject: foo/" in the database it only matches
> if it finds "/^Subject: foo/" (rather than matching on "Subject:
> foo"). Anyone know how I can get the regular expression strings in
> the database to be interpreted as regexp?

    Write your SQL query so that it does a regexp match. Logically,
a map in Postfix is a sort of recipe that translates a given input
to a well-defined (that is, consistently reproducible) output. For
$header_checks, the input is a header line, and the output is one of
"OK", "REJECT", or "don't know". The translation process depends on
the _type_ of the map, but not on _where_ the result is used. A map of
type "hash" will lookup the input as a key in a hashed database, and
return the corresponding value, or "don't know" if not found. A map of
type "regexp" or "pcre" will match the input against each regexps in a
given file, and return the corresponding rhs if a match is found, or a
"don't know" otherwise. A "mysql" map builds a query from the SELECT
you supply and the input, and returns whatever the database returns in
response to the query. It doesn't matter whether the map is used in a
$header_checks, in a $canonical_maps, in a transport table, or somewhere
else; the result of the lookup only depends on the type of the map. The
magic of doing regexp matches if $header_checks is of type "regexp" or
"pcre" is contained in the type of the map; if you change the type,
you lose the magic. Now, in the case of "mysql" maps you can still
get it back because MySQL can do regexp matches in queries: just write
your SELECT with a regexp match clause. Postfix won't do it for you
automatically.

    That said, I'm not sure using a "mysql" map for $header_checks
is a good idea: a query will be issued for each header line, and the
resulting performance would be less than stellar. Why on Earth do you
want to do that anyway?

    Regards,

    Liviu Daia

Postfix: header/body_checks using MySQL:【上一篇】
企业sendmail的架构:【下一篇】
【相关文章】
  • Postfix: header/body_checks using MySQL
  • postfix+mysql+apache+cyrus-sasl2+courier-imap安装
  • 续postfix+mysql,添加病毒和垃圾邮件扫描功能,Clamav+SpamAssassin
  • 简易安装postfix邮件服务器
  • 在Linux平台上安装基于Postfix、Courier-imap、Extmail的邮件系统
  • postfix最完整文档(轉)
  • sarge+postfix+mysql+webmail+web admin安装配置指南
  • 决定用开始研究邮件系统,使用postfix
  • 在RHEL 4 上配置全功能的Postfix 服务器
  • Postfix Integrated Solution OpenLDAP
  • 【随机文章】
  • 计算机中字符的Unicode编码,简要介绍UCS、UTF、BMP、BOM,字序等名词
  • 浅谈Java的输入输出编码
  • IT项目经理是否需要技术能力[CSDN]
  • 将数据访问页绑定到断开连接的记录集
  • AuthorWare中使用交互的几个注意点
  • FreeBSD 4.5 下Squid 代理服务器配置心得
  • sudo --允许其他的用户执行root命令
  • HOW TO:配置或数据文件的保存(改进)
  • 合并内核与romfs(以及独立的内核与romfs)映象文件的方法
  • 用Soft-ICE实现源码级调试
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.