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?