Hi there,

I try to attach an Excel file to a mail via Zend_Mail... That works...
Document attached. But once downloaded : cannot open the document because of
a corrupted content. So, I suppose the issue comes from the PHP function
file_get_contents.

// Attachment
$infos = $form->attachment->getFileInfo();
 $attachment = new
Zend_Mime_Part(file_get_contents($form->attachment->getFileName()));
 $attachment->type        = $form->attachment->getType();
 $attachment->disposition = Zend_Mime::DISPOSITION_INLINE;
 $attachment->encoding    = Zend_Mime::ENCODING_8BIT;
$attachment->filename    = $infos['attachment']['name'];

// Send Email
$mail = new Zend_Mail(APPLICATION_ENCODING);
 $mail->addAttachment($attachment);

I'm sure somebody met that problem before...
-- 
Thomas VEQUAUD          http://thomas.vequaud.free.fr/
Expert EPITECH en Ingénierie Informatique
Tél : +33(0)6.50.39.28.10  Fax: +33(0)9.58.46.10.07

Reply via email to