邮件内容的字符串
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-内联 message.Attachments[j].ContentDisposition.Inline = true; //设置附件的编码格式 message.Attachments[j].TransferEncoding = System.Net.Mime.TransferEncoding.Base64; j++; }
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。