我如何将一些电子邮件路由到Postfix中的脚本?

如何将所有定向到user-*@example.com的电子邮件(例如[email protected])路由到Postfix中的pipe道命令? 这个想法是通过为每个用户分配dynamic电子邮件别名来创buildcraigslist风格的匿名。 但是,我似乎无法在文档中find相关信息。

好的。 现在是一个不同的方法。

master.cf一个新的传输:

 coolscript unix - nn - 50 pipe flags=R user=vmail argv=/path/to/script -o SENDER=${sender} -m USER=${user} EXTENSION=${extension} 

你可以扩展/修改参数,只要你喜欢。

然后(为了消除pcre),你可以使用regexp来做main.cf的“catch-thing”

 transport_maps = regexp:/etc/postfix/redirect.regexp 

并在/etc/postfix/redirect.regexp你把:

 /^user-.*@example\.com/ coolscript: 

postfix reload加载Postfix。

首先检查你是否使用postconf -m将pcre编译到Posfix中。 那么你可以在main.cf设置:

 virtual_alias_maps = pcre:/etc/postfix/redirect.pcre 

并在/etc/postfix/redirect.pcre你把:

 /^user-.*@example\.com$/ somelocalalias 

并在你添加的/etc/aliases

 somelocalalias: |"/path/to/script" 

不要忘了postalias /etc/aliases ,然后用postfix reload