1. Install opendkim package
# yum -y install opendkim
2. Generate dkim key into default keys directory
# opendkim-default-keygen (This command use to generate default key to verify dkim record)
Mainly this file generate two files 1.default.private and 2. Default.txt default.txt is public_key that put on the dns server.
3. Open opendkim.conf file and edit some line or uncomment
# vim /etc/opendkim.conf
Mode sv
Socket inet:8891@127.0.0.1
Canonicalization relaxed/simple
Domain my_domain.com_name
KeyFile /etc/opendkim/keys/opendkim.private
KeyTable refile:/etc/opendkim/KeyTable
SigningTable refile:/etc/opendkim/SigningTable
ExternalIgnoreList refile:/etc/opendkim/TrustedHosts
InternalHosts refile:/etc/opendkim/TrustedHosts
4. Open /etc/opendkim/keyTable file and edit example.com to yourdomain.com
# vim /etc/opendkim/KeyTable
default._domainkey.yourDomain.com yourdomain.com:default:/etc/opendkim/keys/default.private
5. Open SigningTable file and define outgoing mail names
# vim /etc/opendkim/SigningTable
*@yourdomain.com default._domainkey.yourdomian.com
6. Open TrustedHost file and do domain and hostname entry
# vim /etc/opendkim/TrustedHost
127.0.0.1
Mail.yourdomian.com
Yourdomain.com
7. At last edit main.cf file add some line in the last
# vim /etc/postfix/main.cf
smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters
Milters_default_action = accept
8. Restart all services
# systemctl restart opendkim postfix
# systemctl enable opendkim postfix
9. Do entry in DNS Fully Managed VPS Hosting Server
Go to Domain → Go to manage DNS and create record
Type | Name | Value | TTL |
TXT | @ | =spf1 +a +mx +ip4:XX.XX.XX.XX ~all | default |
TXT | default._domainkey | v=DKIM1; k=rsa; p=default.txt file key | default |
TXT | _DMARC | v=DMARC1; p=none | default |