Register Login

SPF & DKIM Verify your emails using PHPMailer

Updated May 18, 2018

If your emails are not SPF & DKIM Verified your will received this error message on Email with “?”

DKIM Verify

Error Msg: Gmail couldn't verify that [domain name] actually sent this message (and not a spammer)

In Gmail if you click on more option and show original you will get full details of your email verification by SPF and DKIM

Show Orignal

SPF un Verified

SPF Verify Email

To get your email SPF verify you need to add TXT record in your DNS Setting

14400 TXT "v=spf1 a mx ip4:xxx.xxx.xxx.xxx ~all"

Type: TXT
HOST:
TTL: 14400
Data: "v=spf1 a mx ip4:xxx.xxx.xxx.xxx ~all"

DKIM Verify

Create Keys
go to URL http://dkimcore.org/tools/ enter your domain name and generate key, please save all keys.

Upload Key
Now upload all keys on your server and also don’t make it public accessible, so upload it outside the public_html folder.

Add TXT Record to your domain DNS settings

Now take the Tinydns Format from dkimcore.org

'1475499327.yourdomain._domainkey.abcd.com:v=DKIM1;p=MIGfMA0GCSqGSIb3DQE BAQUAA4GNADCBiQKBgQCb2cztDn2YITHdhyBeji9TfjOC5uNBsSNI2p2EyoG776k8lMKuN MxS6sug36rqcc5jxXiZIlxJBxH8v/5rPMCKA9ecw/26qt/yeS67ycj0Q1DIuhi518dzbHs0CIgwdX Exhf8bE0l7Tr9twIKje1HTBUxCa6yiq9jXbP3pv3mgfwIDAQAB:3600::

Host Name: 1475499327.yourdomain._domainkey
Type: TXT
TTL: TTL
Data: v=DKIM1;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCb2cztDn2YITHdhyBej i9TfjOC5uNBsSNI2p2EyoG776k8lMKuNMxS6sug36rqcc5jxXiZIlxJBxH8v/5rPMC KA9ecw/26qt/yeS67ycj0Q1DIuhi518dzbHs0CIgwdXExhf8bE0l7T r9twIKje1HTBUxCa6yiq9jXbP3pv3mgfwIDAQAB

DKIM in PHPMailer

$mail->DKIM_domain = 'yourdomain.com';
$mail->DKIM_private = 'path/to/your/private.key>';
$mail->DKIM_selector = '1450071.'yourdomain;
$mail->DKIM_passphrase = '';
$mail->DKIM_identity = $mail->From;

Now send your Email through PHPMailer

Now check in your Gmail for Email verification

SPF: PASS with IP xxx.xxx.xxx.xxx
DKIM: PASS with domain yourdomain.com

DKIM Pass

 

 


×