I've installed a Debian (jessie) box with postfix and spamassassin. Configured and everything works fine.

Except receiving mails with DKIM signatur will produce a flag T_DKIM_INVALID even if the signature is valid. See log example below.

After that, opendkim will verify the signature and let it pass.

Jan 15 14:18:21 localhost spamd[30697]: spamd: connection from localhost []:51740 to port 783, fd 5
Jan 15 14:18:21 localhost spamd[30697]: spamd: processing message <id#1234567@mail.gmail.com> for user
Jan 15 14:18:21 localhost spamd[30697]: spamd: clean message (-2.0/5.0) for user in 0.2 seconds, 2572 bytes.
Jan 15 14:18:21 localhost spamd[30697]: spamd: result: . -1 - BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID scantime=0.4,size=2553,required_score=5.0,rhost=localhost

2 Answers 2


You could give this package a try instead: libmail-dkim-perl

One of the walk-throughs linked in the Spamassassin documentation points out a hint that I would recommend to follow:

"You should NEVER need to use CPAN on a RPM or DEB based Linux distribution."

  • apt-get install libmail-dkim-perl on debian/ubuntu solved the problem
    – rodvlopes
    Mar 2, 2021 at 14:09

This happend because of the missing perl module Mail::DKIM. Without that, every mail with dkim signature will fail the verification. Even those with correct signature.

You can find futher information about it here.

A simple fix is to install the missing module via cpan.

  • on Debian-alikes, better say apt-get install libmail-dkim-perl according to @derasteralex answer
    – Adrian W
    Nov 29, 2019 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.