DKIM Signing is Failed

Okay, let's try this then :)

Open apps/common/mailers/MailerSwiftMailer.php and at line 287 you have:
PHP:
if ($dkimSign && version_compare(PHP_VERSION, '5.3', '>=')) {
    $message = Swift_SignedMessage::newInstance();
    $signer  = new Swift_Signers_DKIMSigner($params->itemAt('dkimPrivateKey'), $params->itemAt('dkimDomain'), $params->itemAt('dkimSelector'));
    $signer->ignoreHeader('Return-Path')->ignoreHeader('Sender');
    $signer->setHashAlgorithm('rsa-sha1');
    $message->attachSigner($signer);
}
make it
PHP:
if ($dkimSign && version_compare(PHP_VERSION, '5.3', '>=')) {
    $message = Swift_SignedMessage::newInstance();
    $signer  = new Swift_Signers_DKIMSigner($params->itemAt('dkimPrivateKey'), $params->itemAt('dkimDomain'), $params->itemAt('dkimSelector'));
    $signer->ignoreHeader('Return-Path')->ignoreHeader('Sender');
    $signer->setHashAlgorithm('rsa-sha1');
    $signer->setHeaderCanon('relaxed');
    $signer->setBodyCanon('relaxed');
    $message->attachSigner($signer);
}
Save the file and try again.
let me know if that does it.
 
@twisted1919
I have identified the problem and well tested and well identified.every thing why DKIM was Failed.

Problem (Need to understand scenario) :
if we put additional x-headers in delivery servers then DKIM Failed..
we put following x-headers to process bounces via PMTA log files

x-job : [CAMPAIGN_UID]
x-envid: [SUBSCRIBER_UID]
SUBSCRIBER_EMAIL : [SUBSCRIBER_EMAIL]
app_url : mailwizz install url

I sent many campaigns all have DKIM Failed

then i did..

test 1: i removed later 2 and tested email ..............Result .........DKIM failed
test 2: then i removed all headers all four..............result.............DKIM Failed (hang on)

Later i identified that 1st two header x-job, x-envid didnt removed and when i save setting/changes in delivery server..even tried many times to remove them...but they didnt removed.. which i discovered later (ITS A BUG)

thats why DKIM Failed for 2nd Case where actually x-headers was not completely removed due to this bug.

then i created a fresh delivery server to to test emails DKIM without adding any x-headers(all four) nothing no header..

DKIM PASSED...

then i again repeated above scenario to verify everything...it was again repeated...

So in nutshell..

1. adding x-headers will fail your DKIM verification
2. if u added a x-header once.. and they will not be removed...even trying n number of times (its a Bug) as for as my testing in concerned.
3. @twisted1919 did some correction in Some files i believe they should be included in next version as they are required(1 with extra spaces and new line in DKIM key removed, 2nd in MailerSwiftMailer.php file )
4. another BUG i discovered in PHPmailer( if you u set PHP mailer then swiftmailer then bounce-server is not picked up for return-part domain(smtp-mail from) instead customer mail from email/domain is used.(further testing and confirmation required)

So now what is the solution?? i hope @twisted1919 will must have a solution for it.
We need to add x-headers for various reasons i.e Bounce Processors, Virtual-MTA selection and many more...

it took my 20 hours constantly to identify this BUG & Scenario..thanks for @twisted1919 for help & support..

Regards

Pradeep
 
@pradeep sharma - Based on what you said, i did some modifications to the apps/common/components/mailers/MailSwiftMailer.php file.
Find it attached. Unzip it and place it on your server and give it a try.
 

Attachments

  • MailerSwiftMailer.php.zip
    4 KB · Views: 10
Back
Top