重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

C#发送邮件并将图片插入邮件内容

邮件内容的字符串

创新互联是一家专业提供鼓楼企业网站建设,专注与网站设计、成都做网站、H5技术、小程序制作等业务。10年已为鼓楼众多企业、政府机构等服务。创新互联专业的建站公司优惠进行中。

StringBuilder Mbody = new StringBuilder();            Mbody.AppendLine("尊敬的领导:");            Mbody.AppendLine("
");            Mbody.AppendLine("

    您好!

");            Mbody.AppendLine("

" + mail.MailBoby + "

");            int id = 0;            foreach (Models.ChartInfoModel item in mail.ChartList)            {                Mbody.AppendLine("" + "");                Mbody.AppendLine(" ");                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++;            }



新闻标题:C#发送邮件并将图片插入邮件内容
网站URL:http://cqcxhl.com/article/jhsghj.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP