emailing a web page as plain text
HTMLDocument htmlPage = (HTMLDocument)WebBrowser.Document;
email.BodyFormat = MailFormat.Html;
email.Body = htmlPage.body.innerHTML;
email.From = "me@here.com";
email.To = "you@there.com";
email.Subject = "subject";
SmtpMail.SmtpServer = settings.SMTPServer;
SmtpMail.Send(email);
Then, I looked at how to send as plain text, which I used htmlPage.body.innerText, however, this rendered the links unusable, simply saying "Click here" rather than Click here So, I decided to render links as "text" (url). So they could still be used. To do this, I could use extensive parsing and regular expressions, or this nifty piece of code:
foreach(IHTMLElement htmElement in htmlPage.links)
{
IHTMLAnchorElement htmLink = (IHTMLAnchorElement)htmElement;
htmElement.innerHTML = htmElement.innerText + " (" + htmLink.href + ")";
}
email.BodyFormat = MailFormat.Text;
email.Body = htmlPage.body.innerText;
Nice eh?