Framework EDI Reference. Methods and Properties
mailMessage. Prepare

Applies the changes made to the message and returns a new message based on the changes.

Syntax:

Returns

Returns 1 if the operation is successful; returns 0 if the operation fails.

Remarks

The prepare method allows new configurations in a message to be applied, and generates a new message showing the result of those changes without modifying the original message.  For example, configuring a message to be digitally signed results in a new message that has been structurally changed to conform to the signature.  Only the new message will bear the changes, the original will not.

The result of the previous operation generates a new message that can further be configured to generate a new message.

 

Example

Dim oEdiDoc As Fredi.ediDocument
Dim oMailDocument As Fredi.mailDocument
Dim oTransferEncoding As Fredi.mailTransferEncoding
Dim oMessage As Fredi.mailMessage

' Create instance of Framework EDI.
Set oEdiDoc = New Fredi.ediDocument

' Get internet mail document object
Set oMailDocument = oEdiDoc.GetMailDocument

' Load the mail document containing the EDI data.
oMailDocument.Load App.Path & "\SampleMail.TXT"

' Get the top message.
Set oMessage = oMailDocument.GetMessage

' Get the content-transfer-encoding header.
Set oTransferEncoding = oMessage.GetContentTransferEncoding

' Modify header to "base64" encoding.
oTransferEncoding.MechanismName = "base64"

' Save unprepared output.
oMailDocument.Save App.Path & "\UnpreparedOutput.TXT"

' Apply "base64" encoding when preparing message.
oMessage.Prepare

' Save prepared output.
oMailDocument.Save App.Path & "\PreparedOutput.TXT"

MsgBox "Done"

Samples