After you have created the TemplateEmailInfoImpl
object, you need to create a targeted list of people to send the mail to. This list of recipient profiles can be a Collection
, an Enumeration
, an array of profile objects, or a group of String-based e-mail addresses. You can also create a mixed list of profile objects and String e-mail addresses. Typically, however, you would obtain the recipient profile list by targeting the profile repository for profiles that satisfy some particular criteria. Two ways to get a recipient profile list are:
After you have defined your recipient list, call the TemplateEmailSender
’s sendEmailMessage
method, passing in the TemplateEmailInfoImpl
object corresponding to the e-mail and a Collection
, Enumeration
, or array representing the recipient list.
Using the TargetingResults Class
The atg.targeting
package includes a class, atg.targeting.TargetingResults
, that you can use to generate targeted recipient lists. TargetingResults
is a Nucleus service that can be configured with the specific Targeter
and NameResolver
, and used to produce the corresponding TargetingEnumeration
objects.
Set the targeter
property of the TargetingResults
component to point to a targeter that operates over a profile repository (such as /atg/userprofiling/ProfileAdapterRepository
). You can configure the targeter service in the Business Control Center (see the ATG Business Control Center User's Guide), in the ACC (see the Matching Content with Your Target Audience chapter in the ATG Personalization Guide for Business Users), or by hand (see the Creating Rules for Targeting Content and Setting Up Targeting Services chapters in this manual).
Once you have defined the TargetingResults
object, you can obtain a recipient list by calling TargetingResults.getResults()
.
Targeting with Profile Groups
Another way to obtain the recipient list is by asking a profile group for its members. You can create profile groups using the ACC (see the Creating Profile Groups chapter in the ATG Personalization Guide for Business Users) or programmatically (see the Setting Up Targeting Services chapter in this manual). Assuming you have a pointer to a profileGroup
(of type RepositoryItemGroup
), you can create a list of recipients that includes all the members of the profile group:
Object[] recipients = profileGroup.getGroupMembers();