Controls Html Encoding for non Ascii characters.
Some mail gateways do not like non-ascii content. Also, some email clients prefer that all non-ascii characters be Html encoded. This option controls the HtmlUtility class, and can encode any non-ascii characters.
For example, if the NamedCodes option is selected, a © would be converted to ©. However, if the NumberedCodes option was selected, it would be converted to ©
[C#]
HtmlUtility utility = new HtmlUtility();
string url = "http://www.microsoft.com";
utility.LoadUrl( url );
//convert all non-ascii characters to numbered code
utility.HtmlEncodeOption = HtmlEncodeOption.NumberedCodes;
//render the Html so it is properly formatted for email
utility.Render( EmbedImageOption.ContentId, true );
//create an EmailMessage with appropriate text and html parts
EmailMessage email = utility.ToEmailMessage();
//load To, From, Server, etc... values from the web.config
email.LoadFromConfig();
email.Subject = "Html Utility Test";
email.Send();
[VB.NET]
Dim utility As New HtmlUtility()
Dim url As String = "http://www.microsoft.com"
utility.LoadUrl(url)
'convert all non-ascii characters to numbered code
utility.HtmlEncodeOption = HtmlEncodeOption.NumberedCodes
'render the Html so it is properly formatted for email
utility.Render(EmbedImageOption.ContentId, True)
'create an EmailMessage with appropriate text and html parts
Dim email As EmailMessage = utility.ToEmailMessage()
'load To, From, Server, etc... values from the web.config
email.LoadFromConfig()
email.Subject = "Html Utility Test"
email.Send()
| Member Name | Description |
|---|---|
| None | Does not modify any of the Html Content. |
| NamedCodes | First check to see if a named Html code exists for a character, if not, the numbered Html code is used. |
| NumberedCodes | Use Html number codes for all non-ascii content. |
Namespace: aspNetEmail
Assembly: aspNetEmail (in aspNetEmail.dll)