What is the right way to add an attachment when using Zend_Mail? I keep getting the following error when I try to open the attached pdf in the sent mail: "Cannot extract the embedded font 'BAAAAAA+ArialMT'. Some characters may not display or print correctly." The PDF shows only the table but no characters.
This is very weird because the PDF opens corectly if i download it directly from the server or on my localhost.
This is the code I used for sending the attachement:
$html = $view->render('email/invoice.phtml');
$mail = new Zend_Mail("utf-8");
$file = PUBLIC_PATH . DS . 'data' . DS . $invoice . '.pdf';
$at = new Zend_Mime_Part(file_get_contents($file));
$at->filename = basename($file);
$at->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
$at->encoding = Zend_Mime::ENCODING_8BIT;
$mail->addAttachment($at);
/* Here i add the attachment */
$mail->setBodyHtml($html);
$mail->addTo($order->email, 'Factura '. $invoice . ' '.Zend_Registry::get('siteName'));
$mail->setFrom('[email protected]', Zend_Registry::get('siteName'));
$mail->setSubject('Factura '. $invoice . ' '.Zend_Registry::get('siteName'));
$mail->send();