Method MIMEMessage():setDeliveryNotification() Professional

Configures the sending of Delivery Service Notification e-mails

:setDeliveryNotification( aNotify [, cRef] ) --> self
The parameter <aNotify> is an array whose elements specify the events for which delivery status notifications are created.
The following table describes the possible values which can be passed in the elements of the array:
Value Description
"failure" Send a DSN when mail delivery fails
"delay" Send DSNs when mail delivery is delayed
"success" Send DSN when mail delivery succeeds
"never" Do not send any DSN
The option "never" can only be used exclusively. If <aNotify>contains other elements besides "never", "never" is ignored.
The optional parameter <cRef> is a character string which specifies how the original e-mail is referenced in the delivery status notifications. The following values can be used with this parameter:
Value Description
"full" The notifications contain the complete original e-mail
"headers" Only the headers of the original e-mail are included

On the way to the recipient of an e-mail, the Mail Transfer Agents or Mail Delivery Agents involved can send back so-called delivery status notifications (DSNs) to the sender. These notifications are delivered as separate e-mails to the sender's inbox. DSNs can be generated if the transmission is successful, delayed or failed. The parameter <aNotify> can be used to specify for which of these events a DSN shall be sent. Alternatively, the sending of delivery status notifications can be switched off.

A DSN contains an attachment to refer to the original e-mail. The parameter <cRef>can be used to determine whether this attachment contains the complete original e-mail or only its headers.

The method :setDeliveryNotification() generates a runtime error if incorrect parameters are passed.

This shows various examples for requesting Delivery Status Notifications:

// Suppress the transmission of DSN e-mails: 
oMimeMessage:setDeliveryNotification( {"never"} ) 

// Request for DSN e-mails in case of delayed or failed delivery: 
oMimeMessage:setDeliveryNotification( {"failure", "delay"} ) 

// Request for a DSN e-mail containing the complete original e-mail in case of successful delivery: 
oMimeMessage:setDeliveryNotification( {"success"}, "full"} ) 

Adhering to the configuration set via :setDeliveryNotification() is not mandatory for a Mail Transfer Agent or Mail Delivery Agent. Often, DSN's are implicitly switched off to avoid the overhead caused by SPAM mails.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.