There seems to be a limitation in outlook when rendering emails which have SSRS reports embedded within them where tables widths are smaller than expected.
To get around this place a text box in the headerfooterbody with a continues alphanumeric string. Also, set the InteractiveSize property within the report to 0,0 so that no paging will display within the email.
Results after the change:
Example URL:
Code used to send the email:
private void EmailNewProduct()
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress(_mailFrom);
mail.To.Add(_mailTo);
mail.Subject = _mailSubject;
mail.IsBodyHtml = true;
// Build the request to get the report
WebRequest request = WebRequest.Create(_reportUrl);
request.Credentials = CredentialCache.DefaultCredentials;
request.Timeout = _reportTimeout;
// Get the report and add it to the email body.
WebResponse response = request.GetResponse();
using (StreamReader streaReader = new StreamReader(response.GetResponseStream()))
{
mail.Body = streaReader.ReadToEnd();
}
SmtpClient smtp = new SmtpClient(_smtpServer);
smtp.Send(mail);
}
private void EmailNewProduct() { MailMessage mail = new MailMessage(); mail.From = new MailAddress(_mailFrom); mail.To.Add(_mailTo); mail.Subject = _mailSubject; mail.IsBodyHtml = true;
// Build the request to get the report WebRequest request = WebRequest.Create(_reportUrl); request.Credentials = CredentialCache.DefaultCredentials; request.Timeout = _reportTimeout;
// Get the report and add it to the email body. WebResponse response = request.GetResponse(); using (StreamReader streaReader = new StreamReader(response.GetResponseStream())) { mail.Body = streaReader.ReadToEnd(); }
SmtpClient smtp = new SmtpClient(_smtpServer); smtp.Send(mail); }
Hi Kazim,
Thanks for the post. It saved me from lot of wasted hours.
Regards,
Michael
LikeLike
This saved me lots of frustration!! So thankful.
LikeLike