本文介绍了Pdf创建并作为邮件附件发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个输入表单,我已填写,现在提交我想在输入表格中发送详细信息作为pdf邮件作为附件





代码:





[授权]

[HttpGet]

public ActionResult InCountryForm(string ac)

{

DisplayLnd dn = new DisplayLnd();

DbAccess da = new DbAccess();

dn.Lnd_Program = new LndFeedback.Models.lnd_prgm();

dn.Lnd_Program.create_date = DateTime.Now;

dn.Lnd_Program.from_date = DateTime.Now;

dn.Lnd_Program.till_date = DateTime.Now;

dn.Lnd_Program.create_by = User.Identity.Name;

dn.Lnd_Program.prgm_id = ac;

dn.Lnd_Program.prgm_type =IN COUNTRY;

dn.Lnd_Program.country_id = 72 ;

dn.Lnd_Program.no_of_attendees =0;

dn.txt = DateTime.Now.ToString(dddd,dd MMMM yyyy);

dn.nwTm = DateTime .Now.ToShortTimeString();

//dn.Lnd_Program.from_date = dn.Lnd_Program.from_date;

//dn.Lnd_Program.till_date = dn.Lnd_Program.till_date;

dn.ListAgency = da.FindAgencyList();

dn.ListState = da.FindStates();

返回查看(dn);

}



[HttpPost]

[ValidateAntiForgeryToken]

public ActionResult InCountryForm(DisplayLnd dn)

{



DbAccess da = new DbAccess();

lnd_prgm Lnd_Program = dn.Lnd_Program;



DisplayLnd对象在GET方法中填写了所有细节

我想在post方法中创建pdf,然后将其邮寄给人。



我尝试过:



创建的pdf不应存储在任何服务器中。所以基本上是飞行pdf然后邮寄它作为附件。

i have an input form which i have filled , now on the submission i want to send the details in the input form as a pdf in mail as an attachment


Code:


[Authorize]
[HttpGet]
public ActionResult InCountryForm(string ac)
{
DisplayLnd dn = new DisplayLnd();
DbAccess da = new DbAccess();
dn.Lnd_Program = new LndFeedback.Models.lnd_prgm();
dn.Lnd_Program.create_date = DateTime.Now;
dn.Lnd_Program.from_date = DateTime.Now;
dn.Lnd_Program.till_date = DateTime.Now;
dn.Lnd_Program.create_by = User.Identity.Name;
dn.Lnd_Program.prgm_id = ac;
dn.Lnd_Program.prgm_type = "IN COUNTRY";
dn.Lnd_Program.country_id = 72;
dn.Lnd_Program.no_of_attendees = "0";
dn.txt = DateTime.Now.ToString("dddd, dd MMMM yyyy");
dn.nwTm = DateTime.Now.ToShortTimeString();
//dn.Lnd_Program.from_date = dn.Lnd_Program.from_date;
//dn.Lnd_Program.till_date = dn.Lnd_Program.till_date;
dn.ListAgency = da.FindAgencyList();
dn.ListState = da.FindStates();
return View(dn);
}

[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult InCountryForm(DisplayLnd dn)
{

DbAccess da = new DbAccess();
lnd_prgm Lnd_Program = dn.Lnd_Program;

The DisplayLnd object has all the details filled in the GET Method
i want to create the pdf in the post method and then mail it toa person.

What I have tried:

the pdf created should not be stored in any server. So basically on th fly pdf and then mail it as an attachment.

推荐答案


这篇关于Pdf创建并作为邮件附件发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 17:14