赶上任何域名,但本地帐户的所有帐户

对于开发平台,我试图configurationpostfix,以便捕获由本地运行的应用程序发送的所有邮件,并将它们redirect到在外部邮件服务器(我们的公司邮件服务器)上pipe理的通用邮箱。 我也希望本地邮件帐户保持正常运行(例如,像往常一样将crontab报告发送到[email protected]

为此,我创build了一个/etc/postfix/virtual文件如下

 /(?<!@my-workstation\.local)$/ generic_account 

我testing了这个文件如下:

 $ postmap -q [email protected] pcre:/etc/postfix/virtual generic_account $ postmap -q [email protected] pcre:/etc/postfix/virtual generic_account $ postmap -q [email protected] pcre:/etc/postfix/virtual $ postmap -q [email protected] pcre:/etc/postfix/virtual 

它似乎没问题:任何不是@my-workstation.local一部分的邮件地址都被replace为generic_account@my-workstation.local所有邮件地址部分都保持不变。

为了将generic_account路由到我的公司邮件服务器,我编辑了/etc/aliases并添加了一些内容,如下面的行(使用我们的真实域名和configuration的工作邮件帐户):

 generic_account: [email protected] 

当然,我添加了以下行到main.cf并重新启动了postfix。

 virtual_alias_maps = pcre:/etc/postfix/virtual 

现在,当我尝试下面的命令,我得到一个不需要的行为:

 $ echo "Subject: sendmail test" | sendmail -v [email protected] Aug 28 10:38:07 my-workstation postfix/pickup[4841]: 89E553960E57: uid=0 from=<root> Aug 28 10:38:07 my-workstation postfix/cleanup[5006]: 89E553960E57: message-id=<[email protected]> Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: 89E553960E57: from=<[email protected]>, size=302, nrcpt=1 (queue active) Aug 28 10:38:07 my-workstation postfix/trivial-rewrite[5007]: warning: do not list domain my-workstation.local in BOTH mydestination and virtual_alias_domains Aug 28 10:38:07 my-workstation postfix/cleanup[5012]: 9663D3960E4D: message-id=<[email protected]> Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: 9663D3960E4D: from=<[email protected]>, size=453, nrcpt=1 (queue active) Aug 28 10:38:07 my-workstation postfix/trivial-rewrite[5007]: warning: do not list domain my-workstation.local in BOTH mydestination and virtual_alias_domains Aug 28 10:38:07 my-workstation postfix/cleanup[5006]: A4E163960E5D: message-id=<[email protected]> Aug 28 10:38:07 my-workstation postfix/local[5010]: 89E553960E57: to=<[email protected]>, relay=local, delay=0.25, delays=0.11/0/0/0.14, dsn=2.0.0, status=sent (forwarded as 9663D3960E4D) Aug 28 10:38:07 my-workstation postfix/local[5008]: 9663D3960E4D: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.14, delays=0.06/0/0/0.08, dsn=2.0.0, status=sent (forwarded as A4E163960E5D) Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: A4E163960E5D: from=<[email protected]>, size=609, nrcpt=1 (queue active) Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: 9663D3960E4D: removed Aug 28 10:38:07 my-workstation postfix/cleanup[5012]: B928E3960E4D: message-id=<[email protected]> Aug 28 10:38:07 my-workstation postfix/bounce[5009]: 89E553960E57: sender delivery status notification: B928E3960E4D Aug 28 10:38:07 my-workstation postfix/local[5010]: A4E163960E5D: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.15, delays=0.08/0/0/0.07, dsn=5.4.6, status=bounced (mail forwarding loop for [email protected]) Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: B928E3960E4D: from=<>, size=2021, nrcpt=1 (queue active) Aug 28 10:38:07 my-workstation postfix/trivial-rewrite[5007]: warning: do not list domain my-workstation.local in BOTH mydestination and virtual_alias_domains Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: 89E553960E57: removed Aug 28 10:38:07 my-workstation postfix/cleanup[5006]: C9ACD3960E57: message-id=<[email protected]> Aug 28 10:38:07 my-workstation postfix/cleanup[5012]: C9BB73960E5B: message-id=<[email protected]> Aug 28 10:38:07 my-workstation postfix/local[5008]: B928E3960E4D: to=<[email protected]>, relay=local, delay=0.15, delays=0.07/0/0/0.08, dsn=2.0.0, status=sent (forwarded as C9BB73960E5B) Aug 28 10:38:07 my-workstation postfix/bounce[5011]: A4E163960E5D: sender non-delivery notification: C9ACD3960E57 Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: C9ACD3960E57: from=<>, size=2678, nrcpt=1 (queue active) Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: B928E3960E4D: removed Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: C9BB73960E5B: from=<>, size=2172, nrcpt=1 (queue active) Aug 28 10:38:07 my-workstation postfix/trivial-rewrite[5007]: warning: do not list domain my-workstation.local in BOTH mydestination and virtual_alias_domains Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: A4E163960E5D: removed Aug 28 10:38:07 my-workstation postfix/cleanup[5012]: DE32A3960E4D: message-id=<[email protected]> Aug 28 10:38:07 my-workstation postfix/cleanup[5006]: DE40A3960E5D: message-id=<[email protected]> Aug 28 10:38:07 my-workstation postfix/local[5010]: C9ACD3960E57: to=<[email protected]>, relay=local, delay=0.17, delays=0.08/0/0/0.08, dsn=2.0.0, status=sent (forwarded as DE32A3960E4D) Aug 28 10:38:07 my-workstation postfix/local[5008]: C9BB73960E5B: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.17, delays=0.08/0/0/0.08, dsn=2.0.0, status=sent (forwarded as DE40A3960E5D) Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: DE32A3960E4D: from=<>, size=2829, nrcpt=1 (queue active) Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: C9ACD3960E57: removed Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: C9BB73960E5B: removed Aug 28 10:38:07 my-workstation postfix/qmgr[4843]: DE40A3960E5D: from=<>, size=2328, nrcpt=1 (queue active) Aug 28 10:38:07 my-workstation postfix/cleanup[5006]: F2BB83960E5B: message-id=<[email protected]> Aug 28 10:00:00 my-workstation postfix/local[5010]: DE32A3960E4D: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.17, delays=0.08/0/0/0.08, dsn=2.0.0, status=sent (forwarded as F2BB83960E5B) Aug 28 10:00:00 my-workstation postfix/local[5008]: DE40A3960E5D: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.17, delays=0.08/0/0/0.08, dsn=5.4.6, status=bounced (mail forwarding loop for [email protected]) Aug 28 10:00:00 my-workstation postfix/qmgr[4843]: F2BB83960E5B: from=<>, size=2985, nrcpt=1 (queue active) Aug 28 10:00:00 my-workstation postfix/qmgr[4843]: DE32A3960E4D: removed Aug 28 10:00:00 my-workstation postfix/qmgr[4843]: DE40A3960E5D: removed Aug 28 10:00:00 my-workstation postfix/local[5010]: F2BB83960E5B: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.17, delays=0.08/0/0/0.08, dsn=5.4.6, status=bounced (mail forwarding loop for [email protected]) Aug 28 10:00:00 my-workstation postfix/qmgr[4843]: F2BB83960E5B: removed 

首先:将[email protected]replace为[email protected] ,其中[email protected] postmap -q表示不会。

第二:我注意到这个警告,但不明白它是什么意思: postfix/trivial-rewrite[5007]: warning: do not list domain my-workstation.local in BOTH mydestination and virtual_alias_domains

你的帮助将不胜感激。

谢谢。