GetBodyWithEmbeddedObjects Method
Visual
Basic Tutorial available! (3 pages)
Prepares HTML-formatted messages for displaying them locally, also saving embedded
objects of the message into default or user-specified temporary location.
Note: In web server environment (such as ASP),
use GetBodyWithEmbeddedObjectsEx method.
GetBodyWithEmbeddedObjects method processes the message body (taken from
BodyText property) replacing CIDs (Content-IDs) with corresponding attachments
filenames and saving attachments required for displaying the message body (i.e.
embedded objects) in specified directory. If the message body has non-HTML format,
this stage is skipped.
Optionally, this method supports censoring the message body text using free
MessageCensor
component. Censoring is performed BEFORE processing CIDs, so it is possible
that some embedded objects (such as scripts, applets, ActiveX'es) would be dropped
by the censor and not saved to disk. This avoids overhead of saving unnecessary
files.
The method returns prepared message body text. Original value of BodyText
property is not affected.
As soon as message viewing is finished, call RemoveMessageDirectory method
without parameters to remove temporary folder created by MailBee for displaying
the message.
| strPreparedBody = ObjectName.GetBodyWithEmbeddedObjects([TempDirectoryPath], [MessageDirectoryName], [Censor]) | ||
| Parameters: | ||
| TempDirectoryPath As String | (optional) Path to the temporary directory where MailBee will create message directory for storing temporary files. If not specified, the current user's temporary directory will be used | |
| MessageDirectoryName As String | (optional) The name of the message directory to be created within TempDirectoryPath where temporary files of the current message will be placed. If not specified, the name will be generated by MailBee as MD5 digest of Message-ID | |
| Filter as MC.MessageCensor | (optional) object of MessageCensor class that defines censorship rules. If missing, no censoring is performed | |
| Return value As String | If successful, the result is a prepared body text. Otherwise, zero-length string is returned | |
Usage example:
' VB-only sample (see ASP Tutorial for ASP samples)
Dim Mailer, Censor, Msg
Set Mailer = CreateObject("MailBee.POP3")
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")
Censor.SetDefaults
MsgBox Msg.GetBodyWithEmbeddedObjects(, , Censor)
End If
Mailer.Disconnect
End If
See Also:
"Displaying
HTML-formatted messages in Visual Basic" Tutorial
"Displaying HTML-formatted messages
in ASP" Tutorial
GetBodyWithEmbeddedObjectsEx
Method
RemoveMessageDirectory
Method
GetMessageDirectoryPath
Method
Copyright 2002-2008, AfterLogic Corporation. All rights reserved.