1

I am using zend-mail (updated very recently). I am using IMAP storage to fetch a list of messages with an inordinate (more than half) of the messages reporting a malformed header.

I have reviewed the bug described at: ZendMail - error in headers but I think I have a different problem. Unlike that error, my failure seems to be occurring around a 'content preview' line I receive in many messages.

I've added the failing line text to the error statement:

2018-01-13T11:44:46-05:00 ERR (3): Error reading message 19 -  Malformed header detected  Content preview:  Pacific Operational Science & Technology Conference - POST
2018-01-13T11:44:46-05:00 ERR (3): #0 /var/www/book2/vendor/zendframework/zend-mime/src/Decode.php(149): Zend\Mail\Headers::fromString('Return-Path: <A...', '\r\n')
    #1 /var/www/book2/vendor/zendframework/zend-mail/src/Storage/Part.php(112): Zend\Mime\Decode::splitMessage('Return-Path: <A...', 'Return-Path: <A...', '')

The source code isn't much to look at, the body of the email follows the code snippet

$mP = 1;
$mailServer = new Imap(array("host" => "someHost","user" => "someAccount","password" => "somePassword"));
$eMessage = $mailServer->getMessage($mP);

The text from the email follows:

message has been attached to this so you can view it or label
similar future email.  If you have any questions, see
root\@localhost for details.

 Content preview:  =============================================================================    
Today's topic summary =============================================================================
Group: canvas-lms-users@googlegroups.com Url: https://groups.google.com/forum/ utm_source=digest&utm_medium=email#!forum/canvas-lms-users/topics

To me, it appears that this issue has more to do with the number of blank lines being interpreted as the end of the header or something involved with the'content preview' line. I think the lines in question have been added by spam detection software. If no 'content preview' - email headers process fine.

Any help?

ebcken
  • 11
  • 2
  • The problem was related to the X-Ham-Report being added by my provider's spam detection software. Once I disabled the the Spam detection feature, e-mail headers were no longer throwing exceptions in Zend's headers.php. It appears as though the blank line between the X-Ham-Report header and the Content preview is what causes headers.php to complain about malformed headers. – ebcken Jan 15 '18 at 03:04

1 Answers1

0

I believe this is a Bug in Spamassassin. The apparently empty line above the Content preview: actually contains one space. According to RFC5322 section 3.2.2 this is a MUST NOT, presumably because there is buggy software out there (and I have seen some) that treats this empty line as the separator between the Headers and the Body of the message (the correct separator is a blank line with Nothing in it).

So Spamassassin it producing emails that do not comply with the established Internet Standards, and that is a big NO-NO.

I would be interested to hear of other examples caused by this.