DKIM signature is not verified when sending mail using PHP

I am having a problem with gmail / hotmail email filters from my server as spam. Spam Assassin's score is pretty low, so I know that my IP address is not in any blacklists, or something like the filtering that gmail / hotmail uses to stop sending emails.

I did some research and read that using DKIM might solve the problems that I am having. I went ahead and enabled DKIM on my server. Now when I send emails using my email client, the tool located here ( http://www.brandonchecketts.com/emailtest.php ) reports that the DKIM signature is valid.

The next step was to embed the DKIM signature in my PHP emails. So I went ahead and used this DKIM class located here (http://sourceforge.net/projects/dkim-class-php/), which is a side effect of PHPMailer.

However, when I send emails now, despite having a DKIM signature, I get a strange error from the validation tool.

result = fail Details: message has been altered 

Here you can see the full report: http://www.brandonchecketts.com/emailtest.php?email=K86KTXpMbl%40www.brandonchecketts.com

Thanks for any help, I am desperately trying to get this job done and have been banging my head on the wall for several hours.

+4
source share
2 answers

I answered this here: Setting up DomainKeys / DKIM in an SMTP client in PHP

Basically, you need to ensure that you supply all the headers that your MTA adds to your email. Since different systems are configured differently, none of them are suitable for all solutions.

Look at the source of the message that failed to subscribe (and gives the message Message modified ) to find out which headers were added. Typically, your MTA will add a Message-ID and Date header (the Date header can also cause a low spam azasin score if it is missing, so you can also include it!).

Another common mistake is that you change the message yourself after signing the message, so do not make any changes to the code after you signed your message.

After determining which headers have been added, you must add these headers yourself (and therefore override the default behavior of your MTA by adding them) to the email before signing.

+3
source

I found the strange behavior of php mail () + postfix with dkim:

If you do

 $headers .= "From: USER <$from_email>\n"; 

DKIM will be invalid, but if you run:

 $headers .= "From: USER <" . $from_email . ">\n"; 

All OK! Strange. Very strange. Also, users are advised to do

 trim($emailContent) 
0
source

All Articles