.Net & SharePoint '07

Technical blog for .Net and all SharePoint 2007 related Information

About the author

Me(Prince) and my wife are B.E in I.T & C.S.E respectively.  I a certified MCPD: Web from 2007 Dec. I am Intrestes in Web Application, MOSS, EPM, etc.
Now working with Deira International School, as IT Application & Help Manager. I have started my career as "Software Developer" @  REACH Sewn Technologies and Consulting Pvt. Ltd, Bangalore India from Oct 2004 to Feb 2006, then as "Web & Intranet Developer" @ Fosroc International Ltd, Dubai from April 2006 to Sep 2009.
You can catch me on mail@jpy-tech.com or mail@princepy.com. Or on 00971 - 50 - 4284530 

Google Translate

Tag cloud

Calendar

<<  May 2012  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

RecentComments

Comment RSS

Google Your Location


How do I send a web page via Email ? / How to read a site page in a string?

private void Page_Load(object sender, System.EventArgs e)
    {
        MailMessage mail = new MailMessage();
        mail.To = "me@mycompany.com";
        mail.From = "you@yourcompany.com";
        mail.Subject = "this is a test email.";
        string url = "http://www.microsoft.com";
        mail.Body = HttpContent(url);
        mail.BodyFormat = MailFormat.Html;
        mail.UrlContentBase = url;
        SmtpMail.SmtpServer = "localhost"//your real server goes here
        SmtpMail.Send(mail);
    }
    //screen scrape a page here
    private string HttpContent(string url)
    {
        WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
        StreamReader sr = new StreamReader(objRequest.GetResponse().GetResponseStream());
        string result = sr.ReadToEnd();
        sr.Close();
        return result;
    }


Categories: ASP.Net 2.0 | c#
Posted by admin on Thursday, October 09, 2008 1:22 PM
Permalink | Comments (0) | Post RSSRSS comment feed