我想发送内容中包含一些图像的电子邮件。我想我必须将这些图像作为附件附加到电子邮件中,但我的问题是如何在邮件内容中使用附加图像?
发送邮件的代码
WebMail.SmtpServer = "my.smtp.server";
WebMail.Send(
clientEmail,
subject,
"<html><head></head><body><img src='???' /></body></html>",
myEmail,
null,
new List<string> () { "path" },
true
);
我必须将什么写成 src ?
如有任何帮助,我们将不胜感激。
请您参考如下方法:
在 http://blog.devexperience.net/en/12/Send_an_Email_in_CSharp_with_Inline_attachments.aspx 也有很好的 sample
System.Net.Mail.Message 类:
示例;
var msg = new System.Net.Mail.Message();
msg.isHTML=true;
msg.Body ="<img src=\"cid:IMG1CONTENT\">";
Attachment mya = new Attachment("file-path-here");
mya.ContentId="IMG1CONTENT";
msg.Attachments.Add(mya);
您可以在@ http://msdn.microsoft.com/en-us/library/system.net.mail.attachment.aspx 找到更多详细信息
