| Message Delivery Events | ||
|
Once the SendMessage method is called, three different events will fire in sequence for each recipient. The first event is OnRecipient which has two arguments. The first is the recipient address, and the second is a boolean variant which can be used to prevent delivery of the message to that address. For example, to prevent a message from being sent to anyone with a hotmail.com address, the following code could be used:
If delivery to an address is prevented by setting the Cancel argument to True, the message will continue to be delivered to any remaining recipients. Preventing delivery will not change the contents of the message so if a recipient address is included in the message headers, it will still be visible to any other recipients even though the message was not actually delivered to that address. To cancel delivery of the message and all subsequent recipients, use the Cancel method instead. Once a connection with the mail server has been established, the OnProgress event will begin firing, indicating how much of the message has been delivered. It should be noted that this does not specify the overall progress for multiple recipients but rather the progress in delivering the message for that specific address. To display an overall progress, an application would have to use the OnProgress information in conjunction with the total number of recipients to whom the message is being sent. The Recipients property returns the number of recipients for the current message and the Recipient property array allows an application to enumerate all of the recipient e-mail addresses. After the message has been delivered to the mail server, the OnDelivered event is fired which specifies the recipient address and the size of the message that was sent. It should be noted that there are still circumstances in which a message can be accepted by a mail server but not actually delivered to the user. A server may decide to reject or re-route a message based on its own internal configuration, content filters or message routing rules. To confirm that a message has actually been delivered, set the Options property to mailOptionNotify to enable delivery status notification. Setting the ReturnReceipt property to the sender's e-mail address is another option although this depends on the recipient's software automatically generating the return-receipt message after it has been read. |
||
|
Copyright © 2008 Catalyst Development Corporation. All rights reserved. |
||