【发布时间】:2017-05-15 19:01:09
【问题描述】:
我正在测试不支持 System.Net.Mail 的 .Net Core MVC,我发现的唯一替代方案是 Mailkit,它运行良好,但无法弄清楚如何将我存储在数据库中的附件作为二进制文件发送.我在 MVC 5 中使用了以下内容:
var mail = new MailMessage();
mail.Attachments.Add(new Attachment(new MemoryStream(attachment),
attachmentName, attachmentType));
如何在 MailKit 中做到这一点。
【问题讨论】:
-
那么,问题出在哪里?它有效还是您有问题?
-
它适用于 MVC 5 和 System.Net.Mail。我想使用 Mailkit。
-
显示您当前使用 Mailkit 的代码
标签: c# asp.net-mvc email-attachments memorystream mailkit