ZF-4169: problems with attachments (corrupted attachment)


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 !!!


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

Changing issues in preparation for the 1.7.0 release.