Mail DSNReceivers Collection

The Mail.DSNReceivers collection contains the list of header fields contained in a DSN message. See the Collection Object for standard collection properties and methods.

Syntax

Item = Mail.DSNReceivers(key|index)

Parameters
key
The identifier for the item to return.
index
An index offset indicating which item in the list to return. The index starts at 0
Return Value

Returns a Variant of type String.

Remarks

The DSNReceivers collection may contain the following field:

Original-Recipient Indicates the original recipient address as specified by the sender of the message for which the DSN is being issued. (e.g. "jim@emilltest.com")
X-DB-Original-Recipient This field is an eMill private field. It will only be available in DSNs generated by the Fax and SMS gateways. It contains the original phone number as it is in the receiver list and can be used to know who was the original recipient of the Fax or the SMS.
Final-Recipient Indicates the recipient for which this set of per-recipient fields applies. The Final-Recipient address may differ from the address originally provided by the sender, because it may have been transformed during forwarding and gatewaying into an totally unrecognizable mess. (e.g. "jim@server1.mail.emilltest.com")
Action Indicates the action performed by the Reporting-MTA as a result of its attempt to deliver the message to this recipient address.The action-value may be one of the following: failed, delayed, delivered, relayed, expanded
Status Contains a transport-independent status code which indicates the delivery status of the message to that recipient. See RFC1893 for details.
Remote-MTA Contains a printable ASCII representation of the name of the "remote" MTA that reported delivery status to the "reporting" MTA.
Diagnostic-Code Contains the actual diagnostic code issued by the mail transport
Last-Attempt-Date Gives the date and time of the last attempt to relay, gateway, or deliver the message (whether successful or unsuccessful) by the Reporting MTA
Will-Retry-Until Gives the date after which the Reporting MTA expects to abandon all attempts to deliver the message to that recipient.

See RFC1894 for details about DSN messages.

Example

The following example uses the Original-Envelope-ID to link back to the original receivers database record

Sub Mail_OnReceiveMail
    If Mail.DSNType<>0 Then
        For Each rcv In Mail.DSNReceivers 
            If Mail.DSNReceivers(rcv)("Original-Recipient") <> "" And LCase(Mail.DSNReceivers(rcv)("Action")) = "failed" Then
                aEmail = Split(Mail.DSNReceivers(rcv)("Original-Recipient"), ";") ' Format rfc822;user@domain.com
                sSQL = "SELECT * FROM MyContacts WHERE email='" & Trim(aEmail(1)) & "'"
                ' Execute SQL query...
                ' Update record ...
            End If
        Next
    Else
        Mailing.MoveReceivedMessage "Sales"
    End If
End Sub

Applies To

Mail Object

See Also

DSNHeaders, DSNEnvID, Collection Object


©2001-2015 Active+ Software. All trademarks property of their owners.