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:
- Existing message header and body content are overwritten.
- 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:
- Existing message header and body content are overwritten.
- If the Subject Message and the MDN Message is empty, the MDN Message is generated as above.
- 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>
- The value of the "To" field in the subject message is stored in "From" field header.
- 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:
- Original-Message-ID
- 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".
- If "Reporting-UA" value exists in Subject message, it is stored in "Reporting-UA" of MDN.
- If "AS2-To", "AS3-To" or "From" value exists in Subject message, it is stored in the form "rfc822;<value>" in the "Final-Recipient" of MDN.
- If the "Final-Recipient" field of the MDN exists then the value is stored in the "Original-Recipient" field of the same MDN. The "Final-Recipient" and the "Original-Recipient" must be the same. Otherwise, if the "Original-Recipient" value exists in Subject message, it is stored in "Original-Recipient" of MDN in the following form "rfc822;<value>".
- If "Message-ID" value exists in Subject message, it is stored in "Original-Message-ID" of MDN.
- The "Received-Content-MIC" of MDN is filled with the calculated digest of the subject message.
- "Disposition" with value "manual-action/MDN-sent-manually;processed".
- If errors were generated in the subject document, a header with field name "Error", with value as the description of the error, is created for each error.
- If warnings were generated in the subject document, a header with field name "Warning", with value as the description of the warning, is created for each error.
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