Adding embedded images within mail body phpmailer class

半腔热情 提交于 2019-12-06 03:30:54
JoDev

Don't use $mailer->AddEmbeddedImage, but directly add

<img src="http://.../images/namDiams.png" /> instead.

The mail length should be lighter... And it works.

EDIT

I don't know if it will help you but there is a little mistake here :

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

Should be

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

Another topic here

NathanW

I can confirm that user2189925's answer does work. However, I use the absolute path since the location of the calling script is more likely to change than the location of the image.
e.g.

<img src="C:\folder\images\namDiames.png" />
Naveen

Faced the same problem, then I decided to replace the following

<img src="img/example.jpg"

with

<img src= "https://mysitename.com/img/example.jpg">

and it worked.

just give path of your image to the mail body eg: (img src="../images/cat.jpeg) it will definately work

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!