日期:2014-05-18 浏览次数:21123 次
System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage(); mailMessage.From="发送者邮箱"; mailMessage.To.Add("收件人邮件列表"); mailMessage.CC.Add("抄送人邮件列表"); mailMessage.Subject = subject; AlternateView htmlBody = AlternateView.CreateAlternateViewFromString(content,null,"text/html");//这里的content为邮件内容,内含图片相对路径,有时有多张图片 LinkedResource lrImage = new LinkedResource("a.jpg","image/gif"); lrImage.ContentId = "Email001"; htmlBody.LinkedResources.Add(lrImage); mailMessage.AlternateViews.Add(htmlBody); SmtpClient.Send(mailMessage);
LinkedResource lrImage = new LinkedResource("a.jpg","image/gif");