SSRS 2008 - Sending report as email

Posted by Mozy on Stack Overflow See other posts from Stack Overflow or by Mozy
Published on 2010-05-07T17:52:41Z Indexed on 2010/05/07 17:58 UTC
Read the original article Hit count: 236

Hi all,

What I want to do is render a SSRS 2008 report as HTML (actually MHTML) and send that as the body in an email.

Has anyone done this? I've almost got it (I think) but I seem to have a encoding problem. The email shows up as what looks like some sort of base64 encoding.

Like this: MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_NextPart_01C35DB7.4B204430" X-MSSQLRS-ProducerVersion: V10.0.2531.0 This is a multi-part message in MIME format. ------=_NextPart_01C35DB7.4B204430 Content-ID: Content-Disposition: inline; filename="FollowUpNotification" Content-Type: text/html; name="FollowUpNotification"; charset="utf-8" Content-Transfer-Encoding: base64 PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMDEgVHJhbnNp...

Any ideas on what I'm missing?

Here is a code snippet:

myMail.BodyEncoding = System.Text.Encoding.UTF8;

myMail.IsBodyHtml = true;

WebClient client = new WebClient();

System.Net.NetworkCredential repAuthenticationInfo = 
    new System.Net.NetworkCredential(@"username", @"password");
client.Credentials = repAuthenticationInfo;

client.Encoding = System.Text.Encoding.UTF8;

string messageBody = client.DownloadString(
    "http://<<reportserver>>&rs%3aFormat=MHTML&Parameter=" + Parameter);

myMail.Body = messageBody;

© Stack Overflow or respective owner

Related posts about ssrs-2008

Related posts about reporting-services