Adding an encapsulated email (like a forwarded email) from Zend Mail.

Posted by Kieran on Stack Overflow See other posts from Stack Overflow or by Kieran
Published on 2010-04-19T03:05:00Z Indexed on 2010/04/19 3:13 UTC
Read the original article Hit count: 387

Filed under:
|
|
|

I'm trying to get Zend_Mail to send an encapsulated message - as though it's forwarding an email.

$attachedContent = "<h1>H1 Email</h1>";
$emailContent = "<h1>Email Content>";
$mail = new Zend_Mail();
$mail->setBodyText('text content');
$mail->setBodyHtml($emailContent);
$mail->setFrom('[email protected]', 'GAS');
$mail->addTo('[email protected]', 'GAS');
$at = $mail->createAttachment($attachedContent);
$at->type = 'message/rfc822;
  name="forwarded message"';
$at->disposition = Zend_Mime::DISPOSITION_INLINE;
$at->encoding    = Zend_Mime::ENCODING_7BIT;
$mail->setSubject('Test');
$mail->send();

Mail clients are getting the email, rendering the normal HTML content, and displaying the forwarded message and rendering its contents, however, it's formatting like:

<h1>Email Content</h1>

Can you see what I'm doing wrong? I've not found anything online, and have tried my best to copy the formatting from looking at email source.

Cheers,

Kieran

© Stack Overflow or respective owner

Related posts about zend-framework

Related posts about zend-mail