gpt4 book ai didi

php - 在邮件正文 phpmailer 类中添加嵌入图像

转载 作者:搜寻专家 更新时间:2023-10-31 20:44:01 24 4
gpt4 key购买 nike

我试图在邮件正文中嵌入图片,但最终以附件形式出现

    $mailer->Subject = APP_NAME . " - " . $name . " send you and Ad : " . $row['name'];
$mailer->IsHTML(true);
$mailer->AddEmbeddedImage('../images/namDiams.png', 'logoimg', 'namDimes.png');

//footer
$footer = "Regards<br/><br/>";
$footer .= '<table style="width: 95%">';
$footer .= '<tr>';
$footer .= '<td>';
$footer .= "<strong><span style='font-size: 15px'>NamDimes Team</span></strong><br/>
NamDimes<br/>
Contact Number: " . APP_CONTACT . "<br/>
Email: " . APP_EMAIL . "<br/>
Website: " . APP_WEBSITE . "<br/>";
$footer .= '</td>';
$footer .= '<td style="text-align:right">';
$footer .= '<img src=\"cid:logoimg\" />';
$footer .= '</td>';
$footer .= '</tr>';
$footer .= '</table>';

$mailer->Body = $body . $footer;
$mailer->AltBody="This is text only alternative body.";
$mailer->AddAttachment('../' . $row['image_path'], $row['name'] . ".jpg");

我已经设置了其他所有内容,包括地址,邮件已发送,我想嵌入正文的 Logo 图像作为附件附加,有人知道为什么吗?

最佳答案

不要使用 $mailer->AddEmbeddedImage , 而是直接添加

<img src="http://.../images/namDiams.png" />相反。

邮件长度应该更轻......而且它有效。

编辑

我不知道它是否对你有帮助,但这里有一个小错误:

$mailer->AddEmbeddedImage('../images/namDiams.png', 'logoimg', 'namDimes.png');

应该是

$mailer->AddEmbeddedImage('../images/namDiams.png', 'logoimg', 'namDiames.png');//the last param the second 'a' was missing...

另一个话题here

关于php - 在邮件正文 phpmailer 类中添加嵌入图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15518703/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com