Hi
I need to send a grid by email attachment in excel or pdf fomat.
I have found some thing in telerik forum how to send a report by email likewise i need to send a grid by email.
void MailReport(Telerik.Reporting.Report report, string from, string to, string subject, string body)
{
string mimeType;
string extension;
Encoding encoding;
byte[] reportBytes =
ReportProcessor.Render("PDF", report, null, out mimeType, out extension, out encoding);
MemoryStream ms = new MemoryStream(reportBytes);
ms.Position = 0;
Attachment attachment = new Attachment(ms, report.Name + "." + extension);
MailMessage msg = new MailMessage(from, to, subject, body);
msg.Attachments.Add(attachment);
SmtpClient client = new SmtpClient(smptHost);
client.Send(msg);
}
I need to send a grid by email attachment in excel or pdf fomat.
I have found some thing in telerik forum how to send a report by email likewise i need to send a grid by email.
void MailReport(Telerik.Reporting.Report report, string from, string to, string subject, string body)
{
string mimeType;
string extension;
Encoding encoding;
byte[] reportBytes =
ReportProcessor.Render("PDF", report, null, out mimeType, out extension, out encoding);
MemoryStream ms = new MemoryStream(reportBytes);
ms.Position = 0;
Attachment attachment = new Attachment(ms, report.Name + "." + extension);
MailMessage msg = new MailMessage(from, to, subject, body);
msg.Attachments.Add(attachment);
SmtpClient client = new SmtpClient(smptHost);
client.Send(msg);
}