ZF-2324: Corrupt attachments with MS Exchange/Outlook


Attachments, sent by Zend_Mail to mailboxes on MS Exchange servers and retrieved with Outlook, are corrupt.

The initial conversations about the bug can be found here:…

Two different users also reported the same fix for the problem:……

Each user changed the LINELENGTH in Zend_Mime from 74 to 72, which resolved the problem.


It also affects version 1.5 and seems to be the problem with Microsoft SBS 2003 as mailtransport.

This has been sitting out here for quite a while with no resolution and it's a very simple fix. If there's concern about breaking existing functionality, could we at least make th line length customizable, but defaults to 74, so those of us that need this change can actually use the mail library?

Please evaluate and categorize/assign as necessary.

Just done some testing with one of our clients who has been seeing this corruption for every PDF attached.

Their environment Win2K3 server, Exchange 2K3 (v6.5.76381), XP & Vista Clients Outlook 2K3

Width 74 - PDF files arrive corrupted every time Width 72 - PDF files arrive as expected

Impact on other clients - non noticeable - e.g. SBS Exchange / Outlook 2K3, Thunderbird (multi-platform), Gmail, Hotmail, Yahoo! all work fine.

I'd suggest we move to 72 width as the default (or at least have a configurable option as suggested).

Just to confirm, this is still an issue with 1.5.x ZF.

Further investigation seems to indicate switching to 72 is fine for PDFs but not e.g. Zip files.

Perhaps there's a wider issue at work?!

Our customers have encountered this corruption for every file attached, not only PDF.

Their environment is : Exchange v6.5, Outlook 2K3

I read the source of ezc, PHPmailer class and PEAR::Mail, and I found they all use a line length of 76.

So, I changed the constant LINELENGTH (line 41 of Mime.php) to 76, and it works well for every attachments. I do not tried zip files.

There's a hotfix for it at… It would still be nice to have some workaround for it as most corporate users won't install it untill next service pack is released.

Fixed with r12343. Changed linelength to 72 to be compatible with other mailers.

Changing issues in preparation for the 1.7.0 release.