在域上捕获所有具有特定例外的电子邮件

我想在一个域上设置全部收​​发电子邮件,但也保留除某些电子邮件帐户之外的能力,例如,如果一封电子邮件被发送到一个例外帐户,它会被一个“帐户不存在”错误。 我有什么办法可以做到这一点? 远程托pipe或自托pipe的解决scheme是好的。 基于Linux的解决scheme是自我托pipe的情况下的首选。

具有以下virtusertable条目的sendmail将执行此操作:

 [email protected] fred [email protected] error:nouser 550 User unknown @example.com user294732 

你可以使用Postfix的PCRE表来完成这个任务。 用postconfconfiguration它:

 postconf -e "virtual_alias_maps=pcre:/etc/postfix/virtusertable" 

而一个例如/etc/postfix/virtusertable将如下所示:

 /^alex@example\.com$/ alex /^barry@example\.com$/ barry /(?<!^corey|dave)@example\.com$/ catch-all 

使用这个, alexbarry别名将被交付, coreydave将被拒绝,其他一切将被路由到全部。