我发现:
- 提交的电子邮件已正确签名(即使用 Outlook 和 Thunderbird 等 MUA 发送的电子邮件)
- 命令行发送的电子邮件已正确签名
使用 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 (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/默认/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
答案1
检查您php mail()
发送的电子邮件是否有正确的SMTP From
akaEnvelope From
标头。如果它们没有地址[email protected]
之类的内容SMTP From
,opendkim 将不会像您在文件Domain mysubdomain.domain.tld
中那样对其进行签名/etc/opendkim
。