Framework EDI Reference. Methods and Properties
mailMessage. PrepareNew

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

Syntax:

Returns

If successful, an object of FREDI.mailMessage is returned; otherwise an empty result is returned.

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 oOriginalMessage As Fredi.mailMessage
Dim oPreparedMessage 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 oOriginalMessage = oMailDocument.GetMessage

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

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

' Apply "base64" encoding when preparing message. PrepareNew makes
' the modification to a new message.
Set oPreparedMessage = oOriginalMessage.PrepareNew

' Show outputs
oOriginalMessage.Save App.Path & "\UnpreparedOutput.TXT"
oPreparedMessage.Save App.Path & "\PreparedOutput.TXT"

MsgBox "Done"

Samples