aspNetEmail

HtmlUtility.SetHtmlBaseTag Property

Adds a BASE tag to the Html head section.

public bool SetHtmlBaseTag {get; set;}

Remarks

If the Html has a relevant http:// location, or is loaded from an http://, it is recommended to set this value to true. Some email clients will not properly link to URLs unless the Html has a base tag. It is also recommended to set the EmailMessage.UrlContentBase property with the value from the UrlContentBase value.

Example

[C#]
            //create an EmailMessage from web.config settings
            EmailMessage m = new EmailMessage( true, false );
            m.Subject = "Html Utilty test.";
             
            HtmlUtility utility = new HtmlUtility();
            string url = "http://www.google.com";
            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();
             
            //populate the EmailMessage with appropriate text and html parts
            m = utility.ToEmailMessage( m );
             
            m.Send();
                
[Visual Basic]
            'create an EmailMessage from web.config settings
            Dim m As New EmailMessage(True, False)
            m.Subject = "Html Utilty test."
             
            Dim utility As New HtmlUtility()
            Dim url As String = "http://www.google.com"
            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()
             
            'populate the EmailMessage with appropriate text and html parts
            m = utility.ToEmailMessage(m)
             
            m.Send()
                

See Also

HtmlUtility Class | aspNetEmail Namespace