如何设置Postfix与Opendkim自动签署PHP电子邮件?

我发现:

  • 提交的电子邮件已经正确签名(即与MUA的Outlook和Thunderbird一起发送的邮件)
  • 命令行发送的电子邮件已正确签名

使用PHP发送的电子邮件 ,特别是PHPMailer(非smtp提交,普通PHP mail()签名不正确。

我听说过phpMailDomainSigner,这是一种破解方式,如果可能的话,我想在顶部MTA / milter级别解决这个问题。

这里是:

/etc/opendkim.conf

 # Log to syslog Syslog yes # Required to use local socket with MTAs that access the socket as a non- # privileged user (eg Postfix) #UMask 002 # dkim-milter (2.5.2.dfsg-1ubuntu1) hardy: # Disable new umask option by default (not needed since Ubuntu default # uses a TCP socket instead of a Unix socket). # Attempt to become the specified userid before starting operations. #UserID 105 # 'id postfix' in your shell Domain mysubdomain.domain.tld KeyFile /etc/mail/mail.private Selector mail # Common settings. See dkim-filter.conf(5) for more information. AutoRestart yes Background yes Canonicalization relaxed/relaxed DNSTimeout 5 Mode sv SignatureAlgorithm rsa-sha256 SubDomains no #UseASPDiscard no #Version rfc4871 X-Header no Statistics /var/log/dkim-filter/dkim-stats 

在/ etc /默认/ opendkim

 SOCKET="inet:8891@localhost" 

/etc/postfix/main.cf(configuration文件的最后一行)

 # DKIM milter_default_action = accept milter_protocol = 2 smtpd_milters = inet:localhost:8891 non_smtpd_milters = inet:localhost:8891 

检查您的php mail()发送电子邮件适当SMTP From另一个Envelope From从头。 如果他们没有像SMTP From地址一样的[email protected] ,那么opendkim将不会对你的/etc/opendkim文件中的Domain mysubdomain.domain.tld /etc/opendkim