ZF-4169: problems with attachments (corrupted attachment)

Issue Type: Bug Created: 2008-09-03T02:46:51.000+0000 Last Updated: 2008-11-13T14:10:08.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Nicolas Milesi (nicolas milesi) Assignee: Thomas Weidner (thomas) Tags: - Zend_Mail

  • Zend_Mime

Related issues: Attachments:


I tried to send attachment with Zend_Mail::addAttachment() method, using default options. The mail is generated correctly but there's some problem with the attachment, as it is malformed when received.

$mail = new Zend_Mail('UTF-8');

$tr = new Zend_Mail_Transport_Smtp(''); Zend_Mail::setDefaultTransport($tr);

$mail->setFrom('', 'King Of The World'); $mail->setSubject('... vive les tests'); $mail->setReturnPath(''); $mail->addTo('', 'New Name');
$mail->setBodyText('Hi Bert, Here is an invitation to a great new website.'); $mail->setBodyHtml('vive HTML');

$contents = file_get_contents('C:\test.jpg'); $at =&$mail->createAttachment($contents); $at->type = Zend_Mime::TYPE_OCTETSTREAM; $at->disposition = Zend_Mime::DISPOSITION_ATTACHMENT; $at->encoding = Zend_Mime::ENCODING_BASE64; $at->filename = 'test.jpg';


$contents = file_get_contents('C:\exclam.gif'); $at2 = new Zend_Mime_Part($contents); $at2->type = 'image/gif'; $at2->disposition = Zend_Mime::DISPOSITION_INLINE; $at2->encoding = Zend_Mime::ENCODING_BASE64; $at2->filename = 'exclam.gif';



But after this, it's impossible to open the image. I look after issues and found this:

Key: ZF-589 Problem with mail attachment Created: 22/Nov/06 04:26 PM Updated: 05/Jul/07 02:43 PM

So i changed the Zend_Mime::LINELENGTH to 72 and now it works well !!!


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

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

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

Changing issues in preparation for the 1.7.0 release.

Have you found an issue?

See the Overview section for more details.


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

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