MvcMailer内存流附件过载

时间:2018-08-24 15:38:03

标签: asp.net-mvc attachment mvcmailer

尝试将通过控制器操作在内存中创建的pdf文件作为附件发送,并能够使用为MvcMailer设置的Mailer View。

以下是我在控制器中发送电子邮件的常用方法。

Invoice invoice = db.Invoices.Find(id);
IUserMailer mailer = new UserMailer();
MemoryStream stream = new MemoryStream(PdfMail(4, "Offer"));
Attachment att = new Attachment(stream, "Offer.pdf", "application/pdf");

我尝试了如下构造函数

 mailer.SendPdfInvoice(invoice, att).SendAsync();

但是出现错误无法从“ System.IO.MemoryStream”转换为“ string”吗?有没有办法做到这一点,或者MvcMailer完全支持这一点?

0 个答案:

没有答案