环境:Centos 7.2 + Postfix

第一步:设置源

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

第二步:安装 OpenDKIM

yum install -y opendkim

第三步:生成密匙

opendkim-default-keygen
cd /etc/opendkim/keys/
ll

第四步:修改配置文件

/etc/opendkim.conf —- Config file of opendkim
/etc/opendkim/KeyTable —- As name suggest it defines the path of private key for the domain
/etc/opendkim/SigningTable — This file tells OpenDKIM how to apply the keys.
/etc/opendkim/TrustedHosts — This file defines which hosts are allowed to use keys.

详见:http://www.linuxtechi.com/configure-domainkeys-with-postfix-on-centos-7/

第五步:修改 Postfix 配置文件

在文章底部加上:

smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters
milter_default_action = accept

第六步:重启  OpenDKIM 和 Postfix

hash -r
systemctl start opendkim ; systemctl enable opendkim ; systemctl restart postfix systemctl enable postfix.service

第七步,修改DNS记录(略)