如何让所有的postfix电子邮件有一个从电子邮件地址

我正在使用后缀master.cf中的亚马逊SES看起来像这样….

aws-email unix - nn - - pipe flags=R user=dhiller argv=/usr/bin/perl -I/opt/amazon/ses /opt/amazon/ses/ses- send-email.pl -r --verbose -k /opt/amazon/ses/aws_credentials.conf -e https://em ail.us-east-1.amazonaws.com -f [email protected] ${recipient} 

我希望[email protected]将覆盖从地址,但似乎不起作用,当从wordpress发送虽然它的作品,如果我使用命令行发送。

任何人都知道如何configuration后缀更改所有收到的电子邮件有一个发件人地址之前调用上述亚马逊Perl脚本,所以我的地址是正确的?

谢谢,Dean

我相信解决scheme是通过canonical(5)映射工具,它描述了cleanup(8)守护进程执行的地址清理

  The optional canonical(5) table specifies an address mapping for local and non-local addresses. The mapping is used by the cleanup(8) daemon, before mail is stored into the queue. The address mapping is recursive. ... Typically, one would use the canonical(5) table to replace login names by Firstname.Lastname, or to clean up addresses produced by legacy mail systems. 

如果Wordpress通过SMTP发送邮件,则可以对本地提交( /usr/sbin/sendmail )和远程提交(通过SMTP)执行此地址清除。 您可能需要将您的Wordpress主机名添加到local_header_rewrite_clients

您可以使用postmap(1)命令提供纯文本表(通常是/etc/postfix/canonical )来构build索引数据库。 如果From: from WordPress始终是相同的(例如, [email protected] ),那么该条目将是:

 [email protected] [email protected] 

如果From: from WordPress更改,但域总是相同,则可以使用:

 @alvazan.com [email protected] 

如果From:确实可能是任何东西,并且您始终需要在From:标头中使用[email protected] ,则可以使用正则expression式支持。 我对此有点怀疑,但是这是一个select:

 /./ [email protected] 

您应该将canonical_classesvariables设置为envelope_sender, header_sender 。 (默认情况下,它还包含了envelope_recipientheader_recipient ;它可能并不会伤害它,但是(尤其是那个贪婪的正则expression式选项)可能是灾难性的,这取决于如何使用这个特定的服务器。

我build议在深夜进行testing,并确保在进行所有更改后testing邮件进出系统。 并且不要忘记保持你的configuration在某种源代码控制下。 (但你知道这一切。)