List:Eventum General Discussion« Previous MessageNext Message »
From:Harri Porten Date:July 17 2009 11:00am
Subject:Re: Some E-Mails not being accepted [fixed, preliminary patch]
View as plain text  
On Wed, 15 Jul 2009, Harri Porten wrote:

> From time to time we experience customer e-mails being seen by 
> process_mail_queue.php but never get accepted into the Associated Mails list. 
> I did not find any errors being reported, yet. Re-adding them to the mail 
> queue does not help. Only option is to "forward" them from one of our mail 
> clients.

Debugged the problem with one of those mails now. It contained a 
Message-Id header spanning multiple lines:


I think that's valid. But the preg_match() in Mail::getMessageId() is not 
matching it properly

      if (preg_match('/^Message-ID: (.*)/mi', $headers, $matches)) {
             return trim($matches[1]);

so we ended up with an empty id. And a message with an empty id was 
already stored thus the new mail was ignored.

The attached quick patch fixes the problem by falling back to the hashsum 
algorithm in case the id is empty. Obviously it would be better to fix the 
preg_match() statement but I lack the regexp skills to do that safely.

I see that the newline problem is present for other headers as well. I 
guess the best solution would be to rewrite the class to map_headerinfo() 
which hopefully does RFC-compliant parsing. But that's a bigger job.

Attachment: [text/x-diff]  messageid.diff
Some E-Mails not being acceptedHarri Porten15 Jul
  • Re: Some E-Mails not being acceptedBarry-Home16 Jul
    • Re: Some E-Mails not being acceptedHarri Porten16 Jul
  • Re: Some E-Mails not being accepted [fixed, preliminary patch]Harri Porten17 Jul