MailMessage class have a property named “DeliveryNotificationOptions” and an enumeration of type “DeleiveryNotificationOptions”. DeleiveryNotificationOptions enumeration have values: OnSuccess, OnFailure, Delay, None and Never. You can instruct the SMTP server to send a message to the address of email sender specified in MailMessage.From if message delivery fails, delayed or successfully delivered etc. Following code snippet shows how to set for OnFailure:
MailMessage mail = new MailMessage();
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
No comments:
Post a Comment