Issues

ZF-4360: Incorrect LINELENGTH constant corrupts attachments

Issue Type: Bug Created: 2008-09-23T08:17:54.000+0000 Last Updated: 2008-11-13T14:10:01.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Dale Liszka (daledaledale) Assignee: Thomas Weidner (thomas) Tags: - Zend_Mime

Related issues: Attachments:

Description

Since version 1.0.3 file attachments with Zend_Mail have been failing to decode correctly in my Zend Framework projects. I have come across ZF-4169 and ZF-1795 which led me to change the Zend_Mime::LINELENGTH to 72.

This fixes my corrupt attachments. In testing I see that the default of 74 is actually delivering encodings with line lengths of 77. This is over the RFC 2045 standard of 76:

http://www.faqs.org/rfcs/rfc2045.html

Example Code: $m = new Zend_Mail(); $m->setBodyText('your file is attached'); $m->setFrom('downloads@asdf.com', 'file service'); $m->addTo('asdf@asdf.com', 'asdf'); $m->setSubject('dl test');

$file = '/home/me/cbd20080809.xls'; $attachBody = file_get_contents($file); $filename = basename($file); $m->createAttachment($attachBody, mime_content_type($file), Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $filename);

$m->send( new Zend_Mail_Transport_Smtp('172.30.62.221') );

With this I will get consistently corrupt attachments unless I change Zend_Mime::LINELENGTH to 72. I have duplicated this behavior on 64bit boxes running RHEL4/5 and CentOS 5, php 5.2.5, and Zend Framework 1.0.3 - 1.6.

I hate modifying the framework code but I don't have an alternative.

Comments

Posted by Oz Solomon (osolo) on 2008-10-09T14:33:35.000+0000

76 also seems to work.

76 is the default value used by chunk_split().

Posted by Dale Liszka (daledaledale) on 2008-10-10T10:13:34.000+0000

I also tried 76 with success. I'm not an advocate of either, I just want Zend_Mail to send uncorrupted attachements out-of-the-box.

The weird thing is GMail manages to fix them somehow with 74, no other MTA does. They do some freaky things behind the scenes there.

Posted by Oz Solomon (osolo) on 2008-10-29T11:12:18.000+0000

Note to Zend:

Yet another release of the framework was released without this fix. I can't for the life of me figure out why such a trivial change wouldn't be merged into main. As it stands, I have to manually patch all my servers which is annoying.

Posted by Dale Liszka (daledaledale) on 2008-10-30T15:57:29.000+0000

Agreed, this is very trivial and easy to test. Is anyone out there listening?

Posted by Thomas Weidner (thomas) on 2008-11-06T13:01:15.000+0000

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

Posted by Dale Liszka (daledaledale) on 2008-11-06T13:03:18.000+0000

Super exciting! Thanks Thomas!

Posted by Wil Sinclair (wil) on 2008-11-13T14:10:01.000+0000

Changing issues in preparation for the 1.7.0 release.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts