从 Zend Mail 添加封装的电子邮件(如转发的电子邮件)

发布于 2024-08-29 20:40:21 字数 1070 浏览 2 评论 0原文

我试图让 Zend_Mail 发送封装的消息 - 就像转发电子邮件一样。

$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();

邮件客户端正在获取电子邮件,呈现正常的 HTML 内容,并显示转发的消息并呈现其内容,但是,它的格式如下:

<h1>Email Content</h1>

你能看到我做错了什么吗?我在网上没有找到任何内容,并已尽力从查看电子邮件源中复制格式。

干杯,

基兰

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沙沙粒小 2024-09-05 20:40:21

也许是这些线路造成的?

$attachedContent = "<h1>H1 Email</h1>";
$emailContent = "<h1>Email Content>";

maybe these lines are causing it??

$attachedContent = "<h1>H1 Email</h1>";
$emailContent = "<h1>Email Content>";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文