C# 如何通过c.net中的smtp邮件对象在电子邮件的信头中添加图像?
我需要在C.net中的SMTP邮件的信件中显示图像?如何通过编程方式通过c.net中的smtp邮件对象在电子邮件的信头中添加图像?您可以使用图像标记的ContentID引用电子邮件HTML正文中的图像,如下所示:C# 如何通过c.net中的smtp邮件对象在电子邮件的信头中添加图像?,c#,C#,我需要在C.net中的SMTP邮件的信件中显示图像?如何通过编程方式通过c.net中的smtp邮件对象在电子邮件的信头中添加图像?您可以使用图像标记的ContentID引用电子邮件HTML正文中的图像,如下所示: <IMG SRC="cid:content-id" /> 看看这个: AlternateView body = AlternateView.CreateAlternateViewFromString(m_msg.Body,null,"text/html")
<IMG SRC="cid:content-id" />
看看这个:
AlternateView body = AlternateView.CreateAlternateViewFromString(m_msg.Body,null,"text/html");
//create the LinkedResource (embedded image)
LinkedResource embimg= new LinkedResource(filename,System.Net.Mime.MediaTypeNames.Image.Jpeg);
logo.ContentId = cid; // content-id used in image tag
body.LinkedResources.Add(embimg);
m_msg.AlternateViews.Add(body);