You create targeted e-mail using the atg.userprofiling.email.TemplateEmailInfoImpl
class. This class draws the message body of an e-mail from a page template, invokes a MessageContentProcessor
component to process the content, and then passes the resulting JavaMail object to the TemplateEmailSender
component, which sends the message. The properties of a TemplateEmailInfoImpl
object store values that are specific to an individual e-mail campaign, so you should create a separate instance of this class for each campaign.
You can use targeted e-mail to produce e-mail messages that are personalized for different profiles. The e-mail content is based on a JSP or JHTML template, specified with the templateURL
property of a TemplateEmailInfoImpl
object. Using the dynamic elements of the Page template, you can customize the e-mail for each of your users according to their profile attributes. Here is a JSP example :
<html> <dsp:importbean bean="/atg/userprofiling/Profile"/> <p>Dear <dsp:valueof bean="Profile.firstName">Customer</dsp:valueof>, <p>We're writing to tell you about some exciting new offers ... </html>
The template yields different message text depending on the attributes of the recipient’s profile. You can use ATG’s targeting servlet beans to personalize the content of the message as well. If the template page contains a targeting servlet bean, the servlet bean behaves just as it would in any other page, rendering content targeted to the current profile.
The TemplateEmailInfoImpl
object contains the standard e-mail message attributes as properties. When it invokes the createMessage
method, the specified e-mail attributes create and fill in a javax.mail.Message
object, which can then be sent to the desired recipient using the TemplateEmailSender
service, described in the next section.
The following table describes key properties of the TemplateEmailInfoImpl
class:
Property | Function |
---|---|
| Specifies the URL of a template containing a text version of an HTML message. See Sending Message Content as Both Text and HTML. |
| Enables distributed mailing features for this mailing. See Distributing a Mailing across Multiple Servers. |
| The URL of the template page. Example: If the template contains links to other URLs on your site, you must specify them as absolute URLs in order for the email recipients to be able to access the linked pages. Use the full |
| A name used to identify an e-mail campaign Default: |
| “From” field of the e-mail message Default: |
| A single e-mail address that overrides the Default: |
| “Reply to” field of the e-mail message Default: |
| “Cc” field of the e-mail message Default: |
| “Bcc” field of the e-mail message Default: |
| “Subject” field of the e-mail message Default: |
| Any files to attach to the e-mail message Default: |
|
Default: |
| Overrides the properties set in a JHTML or JSP file and fills the e-mail with values from an e-mail template Default: |
| (Multisite environments) The site ID to use for the message. Retrieved from the Site Context Manager. |
Note that TemplateEmailInfoImpl
is a subclass of the abstract class TemplateEmailInfo
. If you want to create your own template e-mail implementation, you can create a subclass of TemplateEmailInfo
that implements all of its methods, and use it as you would use TemplateEmailInfoImpl
.