Once you have created your messages and identified the list of recipients, you use a TemplateEmailSender
(atg.userprofiling.email.TemplateEmailSender
) to send out the mailing. There is also a TemplateEmailListener
component that listens for events such as success or failure in sending e-mails. See Handling E-mail Problems.
TemplateEmailSender
is the service responsible for sending targeted e-mail. Its sendEmailMessage
method takes a TemplateEmailInfo
object together with a list (Collection
, Enumeration
, or array) of recipient profiles.
Note that, because TemplateEmailSender
’s methods take any TemplateEmailInfo
object, you can use either the TemplateEmailInfoImpl
subclass or a custom subclass you have created.
The TemplateEmailSender
does the following:
It renders the page given by the
TemplateEmailInfo
’stemplateURL
for each of the profiles or e-mail addresses provided.It invokes the
TemplateEmailInfo
’screateMessage
method to obtain the corresponding JavaMail message.It sends the resulting message to each corresponding user (by way of the
EmailMessageSender
component).
The actual sending of the messages is handled by an atg.service.email.EmailMessageSender
component (for example, /atg/dynamo/service/SMTPEmail
), which is specified by TemplateEmailSender
’s emailMessageSender
property.
The Page is rendered once for each user by creating a DynamoHttpServletRequest
and sending it down the ATG servlet pipeline. (In the default configuration; it is also possible to implement other content rendering schemes by specifying different values for the service’s templateRendererServlet
property.) That is, the template page is rendered simply as if it were a normal Oracle Commerce Platform page requested through a browser. See the Request Handling and the Servlet Pipeline chapter in the Platform Programming Guide for more information about how the servlet pipeline handles requests.
The default instance of DynamoHttpServletRequest
associates the recipient profile object with the current session. In other words, it binds the profile object to the session-scoped /atg/userprofiling/Profile
, and allows the page to refer to the profile’s attributes, as well as to include targeting servlet beans that display content targeted to the current profile. Note that the profile must have attributes for the user’s e-mail address and locale (although the locale property value can be null). In addition, the profile must have an attribute named receiveEmail
, and the value of this attribute must be yes
or null.
The following table describes key properties of the TemplateEmailSender
class:
Property | Function |
---|---|
| The name of the component that performs a number of periodic tasks as part of a performing a distributed mailing. For more information, see Distributing a Mailing across Multiple Servers. |
| Property that enables distributed mailing automatically as long as a given mailing does not include transient profiles. For more information, see Distributing a Mailing across Multiple Servers. |
| Name of the e-mail address property in the profile. Default: |
| List of mappings between character sets used in e-mail templates and in messages (see Setting the E-mail Encoding in the Internationalizing a Dynamo Web Site chapter of the Platform Programming Guide.) Default: |
|
Default: |
| The String value for the |
| The String value for the |
| Determines whether this server should participate in a distributed mailing. For more information, see Distributing a Mailing across Multiple Servers. |
|
Default: |
| Name of the locale property in the profile. Default: |
| Session-scoped Default: |
|
Default: |
| List of listeners notified of any targeted e-mail events. Default: There is no existing component for this class |
|
Default: |
| Servlet responsible for rendering the template page. Default: |