postfix的dkim 需要安装opendkim
yum install opendkim -y
export domain=你的域名
mkdir /etc/opendkim/keys/$domain
cd /etc/opendkim/keys/$domain
opendkim-genkey -d $domain -s default
chown -R opendkim:opendkim /etc/opendkim/keys/$domain
echo “default._domainkey.$domain $domain:default:/etc/opendkim/keys/$domain/default.private” >> /etc/opendkim/KeyTable
echo “*@$domain default._domainkey.$domain“ >> /etc/opendkim/SigningTable
#编辑opendkim配置文件
vi /etc/opendkim.conf
Mode sv
KeyFile /etc/opendkim/keys/default.private 这句好像是默认的
KeyTable /etc/opendkim/KeyTable
SigningTable refile:/etc/opendkim/SigningTable
ExternalIgnoreList refile:/etc/opendkim/TrustedHosts
InternalHosts refile:/etc/opendkim/TrustedHosts
#(可选设置)如果要在邮件头信息中输出软件版本,请按如下方式更改参数。
DKIM-Filter: OpenDKIM Filter v2.11.0 mail.wptmdb.com 8D19A3075E24
SoftwareHeader no yes 改为 no
systemctl restart opendkim
systemctl restart postfix
systemctl enable opendkim
postfix还需要添加一下参数
vi /etc/postfix/main.cf
### DKIM Settings
smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters
milter_default_action = accept