Tuesday, September 02, 2008
by
Steve Tsokev
|
Comments
The Report Viewers (Win and Web) do not support sending of reports via e-mail out-of-the-box. To mail a report you have to first render the report programmatically into a convenient format and then attach it to a mail message. Here is a possible way of how to achieve this by using the SmtpClient object:
Â
| 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);  ... |