Framework EDI Reference. Methods and Properties
mailMessage. BuildMDN

Builds a Message Disposition Notification (MDN) structure in the message.

Syntax:

Returns:

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

Remarks:

If this method is called on the Subject Message of the mailDocument object, then the MDN is generated as follows:

  1. Existing message header and body content are overwritten.
  2. The following message headers are created (quotes not included):
    • "MIME-Version" with value "1.0".
    • "Date" with current data as the value.
    • "Content-Type" with value "multipart/report; report-type=disposition-notification; boundary= default.boundary.mdn".< BR>
    • Creates a body part -- the human readable portion of the MDN.  This body part contains no header, and has a body as follows: 
      • If there is no pre-loaded content then the text of the body is: This is an automatically generated human readable text that should be overwritten with the correct text.
      • If there is content then existing values from the following headers are extracted:
        • Date
        • To
        • Subject

        The field values are then formed in the following text that make up the body: The message [with message ID <Original-Message-ID>] [ sent on <Date> ] [ to <To> ] [ with subject "<Subject>" ] has been processed. This does not guarantee that the message has been read or understood .
    • Creates a second body part -- the reported errors of the subject message.  This body part contains the following headers:
      • "Content-Type" with value "message/disposition-notification".
      • "Final-Recipient" with empty value.
      • "Disposition" with value "manual-action/MDN-sent-manually;processed".

 

If this method is called on the MDN Message of the mailDocument object, then the MDN is generated as follows:

  1. Existing message header and body content are overwritten.
  2. If the Subject Message and the MDN Message is empty, the MDN Message is generated as above.
  3. The following message headers are created (quotes not included):

Example:

Dim oEdiDoc As Fredi.ediDocument
Dim oEdiDoc As Fredi.ediDocument
Dim oMailDocument As Fredi.mailDocument
Dim oSubject As Fredi.mailMessage
Dim oMDN As Fredi.mailMessage
Dim sMsg As String

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

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

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

' Get the message.
Set oSubject = oMailDocument.GetMessage

' Get the MDN and build.
Set oMDN = oMailDocument.GetMDN
oMDN.BuildMDN

sMsg = "SUBJECT: " & vbCrLf & vbCrLf
sMsg = sMsg & oSubject.GetMsgString & vbCrLf & vbCrLf
sMsg = sMsg & "MDN: " & vbCrLf & vbCrLf
sMsg = sMsg & oMDN.GetMsgString

MsgBox sMsg