MessageParserConfigAHRefCleanup Property
Gets or sets the options of processing <A HREF> tags in the HTML body.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public AHRefTagAttributes AHRefCleanup { get; set; }

Property Value

Type: AHRefTagAttributes
A set of flags specifying the attributes which should be removed from all <A HREF> tags. The default value is None.

You can use this and AHRefSuffix properties together to decorate <A HREF> tags, for instance, remove Target attribute and add target=_blank to every <A HREF> tag to make links open in a new window.

Note Note
MessageParserConfig object cannot be used on its own. To access its members, the developer should use MailMessage.Parser property.

If you need more advanced methods to post-process HTML body (such as to remove or block unsafe content like Javascript or external images), consider using Processor class and HTML processing rules (for instance, GetSafeHtmlRules).

This sample loads the message from .EML file and removes all Onclick attributes from all <A HREF> tags.
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

// The actual code (put it into a method of your class).
MailMessage msg = new MailMessage();
msg.Parser.AHRefCleanup = AHRefTagAttributes.Onclick;
See Also