我发现:
- 提交的电子邮件已正确签名(即使用 MUA 发送的电子邮件,如 Outlook 和 Thunderbird)
- 命令行发送的电子邮件已正确签名
使用 PHP 发送的电子邮件,特别是 PHPMailer(非 smtp 提交,普通 PHP mail()
)签名不正确。
我听说过 phpMailDomainSigner,这是一种 hack 方法,如果可能的话,我想在顶部解决这个问题 - 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 (e.g. 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/default/opendkim
SOCKET="inet:8891@localhost"
/etc/postfix/main.cf(配置文件的最后几行)
# DKIM
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
检查您
php mail()
发送的电子邮件是否有正确的SMTP From
akaEnvelope From
标头。如果他们没有地址之类的东西,opendkim 不会像您在文件中那样对它们[email protected]
进行签名。SMTP From
Domain mysubdomain.domain.tld
/etc/opendkim