Hey guys,
I have a web form that when you submit it, it will export it to a CSV file. It works fine, it lets you open it up or save it onto your machine but what I want it to do is send it as an attachment in an email. How would I do that? Do I need to save the file first onto the server and than it sends the file in an email? Here's my code so far:
protected void btnSubmit_Click(object sender, EventArgs e)
{
exportToCSV(createDataTable(), "FormSubmission");
}
protected void exportToCSV(DataTable data, string fileName)
{
HttpContext context = HttpContext.Current;
context.Response.Clear();
context.Response.ContentType = "text/csv";
context.Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ".csv");
//rite column header names
for (int i = 0; i < data.Colum ...
Go to the complete details ...