本文介绍了如何在ASP .NET中发送div上的背景图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发送的是带有asp .net图像的电子邮件,但是无法将图像作为div背景发送?
我尝试了什么:
I am sending Email with images in asp .net but not able to send image as div background?
What I have tried:
<pre lang="text">
<img src="cid:image1" />
<div style="background-image:url(cid:image2)">
<p>This is Text!</p>
</div>
</pre>
Email Code.
string image1Path= HttpContext.Current.Server.MapPath(@"~/Images/image1.png");
string image2Path= HttpContext.Current.Server.MapPath(@"~/Images/image2.png");
LinkedResource lnk1= new LinkedResource(image1Path);
LinkedResource lnk2= new LinkedResource(image2Path);
lnk1.ContentId = "image1";
lnk2.ContentId = "image2";
AlternateView av1 = AlternateView.CreateAlternateViewFromString("" + htmlTemplate, null, MediaTypeNames.Text.Html);
av1.LinkedResources.Add(image1);
av1.LinkedResources.Add(image2);
message.AlternateViews.Add(av1);
推荐答案
这篇关于如何在ASP .NET中发送div上的背景图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!