I am using Crystal Report in ASP.NET. I want to send report as body in mail.
My code is as below, it can convert Crystal Report in to html. My Question is how I can put into a body of the mail?
public void Button1_Click(object sender, EventArgs e)
{
MemoryStream oStream; // using System.IO
oStream = (MemoryStream)
CrystalReportSource1.ReportDocument.ExportToStream(
CrystalDecisions.Shared.ExportFormatType.HTML40 );
Response.Clear();
Response.Buffer = true;
Response.ContentType = "text/html";
Response.BinaryWrite(oStream.ToArray());
sendmail();
}
private void sendmail()
{
try
{
MailMessage mailMessage = new MailMessage();
mailMessage.To.Add("");
mailMessage.From = new MailAddress("");
mailMessage.Subject = "welcome";
mailMessage.IsBodyHtml = true;
mailMessage.Body = /**/ What i can code here??????**?
SmtpClient smtpClient = new SmtpClient();
smtpClient.Host = "208.43.62.208";
smtpClient.Port = 2525;
smtpClient.Send(mailMessage);
Response.End();
}
catch (Exception ex)
{
//MessageBox.Show(ex.ToString());
}
}