使用 PHPMailer 发送电子邮件 - 在正文中嵌入图像
我正在尝试使用 PHPMailer 和图像发送 HTML 邮件.正文从包含所有信息的 html 文件加载.
I'm trying to send HTML mail, with PHPMailer, with images. The body is loaded from a html file, that contains all the info.
发送邮件时,图像不会出现在正文中,尽管我什至将图像也作为附件发送.
When sending the mail, the image does not appear in the body, although I even send the image also as an attachment.
HTML 标签指向与地点相同的地点.
HTML <img>
tag points to the same place as the place.
PHP:
$mail->AddAttachment('img/2u_cs_mini.jpg');
如何使 html 指向附件,以便可以在正文中加载图像.
How can I make the html point to the attachment so the image can be loaded in the body.
查看 PHPMailer 附带的示例,我没有注意到任何区别,在他们的情况下,图像确实出现了.
Looking at the example that comes with PHPMailer I do not notice any difference, and in their case the image does appear.
我找到了答案:
$mail->AddEmbeddedImage('img/2u_cs_mini.jpg', 'logo_2u');
并在 标签上放置
src='cid:logo_2u'