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’s templateURL for each of the profiles or e-mail addresses provided.

  • It invokes the TemplateEmailInfo’s createMessage 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 ATG page requested through a browser. See the Request Handling and the Servlet Pipeline chapter in the ATG 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:




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: /atg/userprofiling/PropertyManager


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 ATG Platform Programming Guide.)

Default: SJIS=iso-2022-jp,EUC=iso-2022-jp


EmailMessageSender component responsible for sending the e-mail.

Default: /atg/dynamo/service/SMTPEmail


The String value for the emailStatus profile property, used to flag the status as invalid. Default: invalid.


The String value for the emailStatus profile property, used to flag the status as valid. Default: valid.


Determines whether this server should participate in a distributed mailing. For more information, see Distributing a Mailing across Multiple Servers.


PageEncodingTyper object that determines the encoding used in the e-mail.

Default: /atg/dynamo/servlet/pagecompile/EncodingTyper


Name of the locale property in the profile.

Default: locale


Session-scoped Profile object.

Default: /atg/userprofiling/Profile


HeadPipelineServlet responsible for setting up the request.

Default: /atg/dynamo/servlet/pipeline/DynamoHandler


List of listeners notified of any targeted e-mail events.

Default: There is no existing component for this class


TemplateEmailPersisterImpl component responsible for recording information about a mailing so that the mailing can be restarted if necessary.

Default: /atg/userprofiling/email/TemplateEmailPersister


Servlet responsible for rendering the template page.

Default: /atg/dynamo/servlet/pipeline/DynamoHandler