FilteredText Property  
 

Gets the filtered version of the text in the current message part.

Syntax

object.Text [= value ]

Remarks

The FilteredText property returns filtered text for the current message part, removing any HTML tags and potentially unsafe content. It handles both HTML and plain text content types. For HTML, the markup is converted to plain text and decodes HTML entities. For plain text, it scans for embedded URLs and applies filtering based on the options specified with the Filter property. If the current message part does not contain text (for example, if the current message part is a file attachment), this property will return an empty string.

When filtering HTML markup from message content, this property changes it in the following ways:

  • Removes script, style, and other non-visible or unsafe elements.
  • Converts common tag structures, such as lists and headers, into readable plain text.
  • Extracts and optionally filters or removes hyperlinks and image alt text.
  • Decodes common HTML entities such as &trade and &copy, as well as numeric entites like &#x20.

The property is designed to return clean, human-readable output suitable for previewing message contents in text-only environments, logging, or performing further analysis. It ensures that embedded credentials, tracking links, or insecure resources are removed or sanitized based on filtering preferences.

By default, this property will not remove Unicode characters or strip links unless explicitly instructed via flags by setting the Filter property. The mimeFilterStrict constant is a recommended combination for maximum safety and removes potentially malicious or misleading elements.

To obtain the original message content for the current message part, use the Text property.

If you wish to normalize any text, not simply the text in the current message part, you can use the NormalizeText method. This performs multi-stage normalization on a string or byte array provided as an argument. It is important to note that the NormalizeText method is much stricter with how it validates the input and is designed to throw an exception on malformed text rather than filter it out.

Data Type

String

See Also

Filter Property, Text Property, TextLength Property, NormalizeText Method