简体   繁体   English

使用HTML文件作为邮件正文模板,图像不显示

[英]Using HTML file as mail body template, images are not showing

I am trying to use a HTML file as mail body template. 我正在尝试使用HTML文件作为邮件正文模板。 HTML file has few inline images like LOGO. HTML文件几乎没有内嵌图像,例如LOGO。 Everything is fine and I am getting all contents in the HTML file upon receiving the mail, except the images. 一切都很好,我收到邮件后在HTML文件中获取了所有内容,但图像除外。

An example below src="~/Images/logo.png" but after getting the mail, if I view source in mail client I see like below (using Google SMTP server to send mail). src="~/Images/logo.png"下面的示例,但是在获取邮件后,如果我在邮件客户端中查看源,则如下所示(使用Google SMTP服务器发送邮件)。

Reason is pretty clear as why images are not getting displayed (due to the fact that src part is getting changed) but not sure how to avoid this. 原因很清楚,原因是为什么不显示图像(由于src部分已被更改),但不确定如何避免这种情况。

<img title="MyCompany" class="xxxx" alt="MyCompany"
src="https://ci4.googleusercontent.com/proxy/VigKoQr9DXTS3UveuswmpxB6iEAO5rcVwSrrVUptfWGAeYQFugjcKDZxDZbB6g=s0-d-e1-ft#http://~/Images/logo.png">

Any solution for this? 有什么解决办法吗? How can I get the actual images being displayed? 如何获得显示的实际图像? Thank You. 谢谢。

Here the solution! 这里解决!

For email template you should provide absolute url for the image. 对于电子邮件模板,您应该提供图像的绝对URL。

Ex: <img src="http://ngm.nationalgeographic.com/2015/11/climate-change/which-species-will-thrive/img/12-bengal-tiger-1024.jpg" > 例如: <img src="http://ngm.nationalgeographic.com/2015/11/climate-change/which-species-will-thrive/img/12-bengal-tiger-1024.jpg" >

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

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