Each time TemplateEmailSender sends an e-mail message, it generates an event of class atg.userprofiling.email.TemplateEmailEvent, which indicates whether or not the message was successfully sent. For example, suppose you create a mailing with 10 recipients, and 1 message does not get sent because the recipient has an invalid e-mail address. TemplateEmailSender generates 10 template e-mail events, 9 indicating success and 1 indicating failure.

When a message fails, TemplateEmailSender looks at the e-mail address of the failed message, finds all profiles that use that address, and marks those profiles as being ineligible for receiving e-mail by setting the emailStatus property to invalid.

You can have your application perform specific actions depending on whether a message is successfully sent. For example, you could keep track of the messages that failed and delete the corresponding profiles. To facilitate this type of tracking, the TemplateEmailSender component has a templateEmailListeners property, which is a standard list of listeners notified of any template e-mail events. Any service that you add to this property is notified of each template e-mail event, which your application can then handle appropriately.

Note that if a message is sent successfully, this means only that the message was sent to a legal address (that is, an address that has a legal form, such as someone@some.example.com). A message sent successfully may still bounce if the address is not the actual address of any mailbox.

loading table of contents...