简体   繁体   English

在php中发送带有图片的HTML电子邮件问题

[英]Issue sending html email with images in php

I have two HTML templates. 我有两个HTML模板。 And I buffer them into php email using ob_start() and ob_get_clean() . 我使用ob_start()ob_get_clean()它们缓冲到php电子邮件中。 However, one can be sent without any problem while another has no images in the email body. 但是,可以发送一个没有任何问题,而另一个可以在电子邮件正文中没有图像。 Can anyone find what the problems are? 谁能找到问题所在? Here are the two templates: 这是两个模板:

I have tried to use absolute path for images, and tried to use img tag instead of div with background image, but they don't work. 我试图为图像使用绝对路径,并尝试使用img标签代替带背景图像的div,但是它们不起作用。

You can try uploading images to cloud and use them from there....I am not sure...but may be this helps..!!! 您可以尝试将图像上传到云中并从那里使用它们。...我不确定...但是这可能会有所帮助.. !!! Also, remember putting ob_flush() in such cases. 另外,请记住在这种情况下放入ob_flush()。

You are using CSS in bad.txt file which path you have mentioned is given below. 您正在bad.txt文件中使用CSS,下面给出了您提到的路径。

link href="quote.css" rel="stylesheet" type="text/css" 链接href =“ quote.css” rel =“ stylesheet” type =“ text / css”

so please mentioned your path with http://www.emoceanstudios.com.au/CSS/quote.css it is just a example but please provide full path to get Template as you want. 因此,请使用http://www.emoceanstudios.com.au/CSS/quote.css提及您的路径,这只是一个示例,但请提供完整的路径以获取所需的Template。

link href="http://www.emoceanstudios.com.au/CSS/quote.css" rel="stylesheet" type="text/css" 链接href =“ http://www.emoceanstudios.com.au/CSS/quote.css” rel =“ stylesheet” type =“ text / css”

How about inline image? 内嵌图片怎么样? you can convert the img into data first. 您可以先将img转换为数据。 http://www.websiteoptimization.com/speed/tweak/inline-images/ http://www.websiteoptimization.com/speed/tweak/inline-images/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM