dayiku Posted August 4, 2009 Report Share Posted August 4, 2009 I am trying to send an email to a user after a report has been run. I want to send the web page including the chart in the body of the email. So far i have been working with the webrequest object to get the information. However, i am faced with one significant problem and that is the image for the chart is not included in the email. Please see a sample of my code below private string HttpContent(string url)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> { System.Net.WebRequest objRequest = System.Net.HttpWebRequest.Create(url); StreamReader sr = new StreamReader(objRequest.GetResponse().GetResponseStream()); string result = sr.ReadToEnd(); sr.Close(); return result; } Can somebody tell me how to send a web page contaning a chart as an email body? Thanks, Quote Link to comment Share on other sites More sharing options...
juanZ Posted August 4, 2009 Report Share Posted August 4, 2009 Hi you can create the chart object (the object only), export it as an image (using the export method) to your server physical location and embed the image with an IMG tag in your mails body. DataSelection.zip Quote Link to comment Share on other sites More sharing options...
dayiku Posted August 5, 2009 Author Report Share Posted August 5, 2009 Thanks for your response. Is it possible to send the whole web page, so i can present the chart with some context? I have tried to send it using the webrequest object, but it sends the page without the chart. Quote Link to comment Share on other sites More sharing options...
juanZ Posted August 5, 2009 Report Share Posted August 5, 2009 Well, what I think you can do, is to create a web page that will host the chart in a physical location. Then you can try to embed this page as a frame in your mails body (im not pretty sure if you can do that in a mails body). So, you can try to set to the mails body text, the full HTML text that will define yor inner webpage. replace the hello world space within an iframe or frame pointing to your chart web page. mail.BodyFormat = MailFormat.Html;mail.Body = "<html><body> Hello World </body></html>"; Hope this helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.