システムが送信する電子メールにNReco.PdfGeneratorで作成されたpdfを添付しようとしています。電子メールに動的に作成されたpdfを添付するC#.net Webページ
私が持っている: -
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment; filename=test.pdf");
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
var pdfBytes = htmlToPdf.GeneratePdfFromFile("http://{siteName}/templates/PasswordResetEmail2.cshtml", null);
Response.BinaryWrite(pdfBytes);
そして、これはアウトウィンドウをポップアップ節約にPDFを入れて動作します。
しかし、私は私のシステムの電子メールにこれを取得する必要があり、
WebMail.Send(
to: email,
subject: "Please see attached invoice",
body: BodyTemplate,
isBodyHtml: true,
filesToAttach: invoice.pdf);
はあなたが助けることができると思います。
System.Net.Mail.SmtpClientの使用方法がわかりません。私はasp.net Webページのフレームワークでサイトを作っています。私はそれがSystem.Net.Mailクラスを持っているとは思わない。私はアタッチすることができません。 –