中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

C#發(fā)送內(nèi)置圖片的html格式郵件

2018-07-20    來源:open-open

容器云強勢上線!快速搭建集群,上萬Linux鏡像隨意使用

下面的代碼用于發(fā)送html格式的郵件,并且可以將圖片附加到郵件一起發(fā)出

MailMessage m = new MailMessage();
m.From = new MailAddress("ir@sharejs.com", "Raja Item");
m.To.Add(new MailAddress("su@sharejs.com", "Sekaran Uma"));
m.Subject = "html email with embedded image coming!";
  
// Create the HTML message body
// Reference embedded images using the content ID
string htmlBody = "<html><body><h1>Picture</h1><br><img src=\"cid:Pic1\"></body></html>";
AlternateView avHtml = AlternateView.CreateAlternateViewFromString
    (htmlBody, null, MediaTypeNames.Text.Html);
  
// Create a LinkedResource object for each embedded image
LinkedResource pic1 = new LinkedResource("pic.jpg", MediaTypeNames.Image.Jpeg);
pic1.ContentId = "Pic1";
avHtml.LinkedResources.Add(pic1);
  
// Create an alternate view for unsupported clients
string textBody = "You must use an e-mail client that supports HTML messages";
AlternateView avText = AlternateView.CreateAlternateViewFromString
    (textBody, null, MediaTypeNames.Text.Plain);
  
m.AlternateViews.Add(avHtml);
m.AlternateViews.Add(avText);
  
// Send the message
SmtpClient client = new SmtpClient("smtp.sharejs.com");
client.Send(m);

標簽: 代碼

版權申明:本站文章部分自網(wǎng)絡,如有侵權,請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:Android利用DrawerLayout實現(xiàn)抽屜效果

下一篇:php圖片加水印類