Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我应该如何编写将图像嵌入到电子邮件正文的代码?怎么了?
mMailMessage.Body += Server.MapPath(@"<img src=""/Styles/Images/logo.png""");
.
您正在将路径映射到名为"<img src=""/Styles/Images/logo.png"""!
"<img src=""/Styles/Images/logo.png"""
你想要做的是这样的:
mMailMessage.Body += "<img src=\"" + Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port + @"/Styles/Images/logo.png" + "\"/>";