郵件內(nèi)容的字符串
StringBuilder Mbody = new StringBuilder(); Mbody.AppendLine("尊敬的領導:"); Mbody.AppendLine("</br>"); Mbody.AppendLine("<p> 您好!</p>"); Mbody.AppendLine("<p>" + mail.MailBoby + "</p>"); int id = 0; foreach (Models.ChartInfoModel item in mail.ChartList) { Mbody.AppendLine("" + "<a href=" + "'http://10.18.100.77'><img alt='圖片' src=cid:" + id + "></a>"); Mbody.AppendLine(" <hr />"); id++; } /////////////////////////////////// int j = 0; foreach (Models.ChartInfoModel item in mail.ChartList) { string filePath = Path.Combine(item.ChartPath, item.ChartTitle + ".png"); message.Attachments.Add(new Attachment(filePath)); //設置附件類型 message.Attachments[j].ContentType.Name = "p_w_picpath/png"; //設置附件 Id message.Attachments[j].ContentId = j.ToString(); //設置附件為 inline-內(nèi)聯(lián) message.Attachments[j].ContentDisposition.Inline = true; //設置附件的編碼格式 message.Attachments[j].TransferEncoding = System.Net.Mime.TransferEncoding.Base64; j++; }
創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國云服務器,動態(tài)BGP最優(yōu)骨干路由自動選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡助力業(yè)務部署。公司持有工信部辦法的idc、isp許可證, 機房獨有T級流量清洗系統(tǒng)配攻擊溯源,準確進行流量調度,確保服務器高可用性。佳節(jié)活動現(xiàn)已開啟,新人活動云服務器買多久送多久。
網(wǎng)站標題:C#發(fā)送郵件并將圖片插入郵件內(nèi)容-創(chuàng)新互聯(lián)
本文鏈接:http://chinadenli.net/article14/dipede.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設、企業(yè)網(wǎng)站制作、服務器托管、App開發(fā)、網(wǎng)站維護、建站公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)