且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 C# 中的邮件正文中附加图像

更新时间:2022-12-03 09:41:27

    string attachmentPath = Environment.CurrentDirectory + @"	est.png";
    Attachment inline = new Attachment(attachmentPath);
    inline.ContentDisposition.Inline = true;
    inline.ContentDisposition.DispositionType = DispositionTypeNames.Inline;
    inline.ContentId = contentID;
    inline.ContentType.MediaType = "image/png";
    inline.ContentType.Name = Path.GetFileName(attachmentPath);

    message.Attachments.Add(inline);

参考:用 C# 发送带有内联附件的电子邮件