Used for controlling CSS sheets with the HtmlUtility class.
[C#]
HtmlUtility utility = new HtmlUtility();
string url = "http://www.microsoft.com";
//convert linked css sheets to inline <style> content
utility.CssOption = CssOption.EmbedLinkedSheets;
utility.LoadUrl( url );
//set the UrlContent base
utility.SetUrlContentBase = true;
//set the basetag in the html
utility.SetHtmlBaseTag = true;
//render the Html so it is properly formatted for email
utility.Render();
//create an EmailMessage with appropriate text and html parts
EmailMessage email = utility.ToEmailMessage();
//load values from the web.config
email.LoadFromConfig();
email.Subject = "Html Utility Test";
email.Send();
[Visual Basic]
Dim utility As New HtmlUtility()
Dim url As String = "http://www.microsoft.com"
'convert linked css sheets to inline <style> content
utility.CssOption = CssOption.EmbedLinkedSheets
utility.LoadUrl(url)
'set the UrlContent base
utility.SetUrlContentBase = True
'set the basetag in the html
utility.SetHtmlBaseTag = True
'render the Html so it is properly formatted for email
utility.Render()
'create an EmailMessage with appropriate text and html parts
Dim email As EmailMessage = utility.ToEmailMessage()
'load values from the web.config
email.LoadFromConfig()
email.Subject = "Html Utility Test"
email.Send()
| Member Name | Description |
|---|---|
| None | No modifications are made to the Html |
| EmbedLinkedSheets | Any linked CSS sheets are downloaded and converted to inline <style> content. |
Namespace: aspNetEmail
Assembly: aspNetEmail (in aspNetEmail.dll)