GetCensoredBody Method


Returns message body (BodyText property is used as a source) filtered in accordance with default or user defined censorship rules.

Censorship is a process of finding and removing unwanted tags or tag attributes (such as scripts, iframes, embedded objects and so on) from certain HTML document. Also, censorship can be used to find or remove custom text (such as abuse, special keywords or phrases).

Tag censoring usually makes sense for HTML-formatted body (BodyFormat=1). However, text censoring (abuse, etc.) may be also used for plain-text documents.

Note: MessageCensor is a separate (and FREE) product. It can be downloaded from MailBee web site.


strCensoredBody = ObjectName.GetCensoredBody(Filter)  
Parameters:  
Filter as MC.MessageCensor The object of MessageCensor class that defines censorship rules  
Return value As String If successful, result is a filtered BodyText. Otherwise, zero-length string  

Usage example:

Dim Mailer, Censor, Msg
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.POP3")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.POP3")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
Mailer.Connect "mailserver.com", 110, "MyName", "MyPassword"
If Mailer.Connected Then
   If Mailer.MessageCount > 0 Then
      Set Msg = Mailer.RetrieveSingleMessage(1)
      Set Censor = CreateObject("MC.MessageCensor")
      'In ASP use Server.CreateObject("MC.MessageCensor")
      Censor.SetDefaults
      MsgBox Msg.GetCensoredBody(Censor)
   End If
   Mailer.Disconnect
End If

See Also:

Message Object
BodyText Property
GetBodyWithEmbeddedObjects Method
GetBodyWithEmbeddedObjectsEx Method


Copyright 2002-2008, AfterLogic Corporation. All rights reserved.