In this post I am sharing a trick in which we will assign DKIM signature like Sendgrid do.The method is not excatly same but the task can be accomplished.I was getting “no signing table” error.Because of which DKIM-Signature was not attaching in recipient’s email header. My application mailer was using gmail id in from: field .In mail log I found “no signing table for email@example.com”.It means OpenDKIM was looking for example.com in configuration file which do not exist. Because I was not hosting example.com in my mail server because I do not have its DNS Configuration access.
But we have set the Return-Path to our Mail server domain.Hence SPF record has pass status.
First of all lets have a brief introduction about DKIM .
What is DKIM
Abberviation of DKIM is DomainKeys Identified Mail. DKIM provides a method for validating a domain name identity that is associated with a message through cryptographic authentication.DomainKeys Identified Mail (DKIM) lets an organization take responsibility for a message that is in transit.
When you open a header of email,you can see the DKIM-Signature and DKIM status.
DKIM status should be pass (It should not be neutral/fail etc)
As we know, when we send email by using sendgrid. It attaches its DKIM Signature.
Lets have a look in below given sample
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info;
In above sample, you can see the dkim status is pass.And DKIM-Signature has sendgrid domain (d=sendgrid.info)
Now here scenario is, When our application Server send email to our own hosted Mail Server(Postfix+opendkim) . The DKIM should be in pass status. As well as the DKIM signature should have domain name which resembles to our mail server.
Description of our Mail Server :
DNS A Record : sharadchhetri.com
DNS MX Record : mail.sharadchhetri.com
The Opendkim’s SignatureTable file has given below configuration
Application Using email id : firstname.lastname@example.org . With this email id,I was authenticating the account. We have set email@example.com in Return-Path in mailing code.
How I attached my mail server domain name in DKIM signature , to the email header of firstname.lastname@example.org
Configure SigningTable file
(1) In case ,if you want to attach DKIM signature for a particular domain
Edit the SignatureTable file in /etc/opendkim directory
Add below given lines and replace the domain name as per your information
(2) In case ,if you want to attach DKIM signature for all domain
Restart the opendkim
Restart the postfix