This is not Zend issue but Apple Mail issue. Install Thunderbird ;-)
Here are few tips:
- problem like this can occur if you are sending inline files and attachments at the same time
mail app settings are defaulted to inline attachments
- Close Mail
- Open Terminal
- enter command
defaults write com.apple.mail DisableInlineAttachmentViewing -bool yes
, - Open Mail and try again
you should not be explicitly specifying encoding in setting body, your mail is initialized with default 'UTF-8' encoding by the way you
- you should not be encoding header unless you are sending emails in languages that use not Roman letters-based character set
Try attaching the file inline and
$mail = new Zend_Mail('utf-8');
$mail->setFrom('niels@example.com', 'Niels')
->setSubject('Subject')
->addTo('niels@example.com', 'Niels')
->setBodyHtml('Hi there');
// add attachment
$mail->createAttachment(file_get_contents('my_pdf.pdf'), 'application/pdf', Zend_Mime::DISPOSITION_ATTACHMENT , Zend_Mime::ENCODING_BASE64);
// try sending attachment inline... maybe this will work (not sure if supported by all mail clients)
// $mail->createAttachment(file_get_contents('my_pdf.pdf'), 'application/pdf', Zend_Mime::DISPOSITION_INLINE , Zend_Mime::ENCODING_BASE64);
$mail->send();