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

altTemplateURL

Specifies the URL of a template containing a text version of an HTML message. See Sending Message Content as Both Text and HTML.

batched

Enables distributed mailing features for this mailing. See Distributing a Mailing across Multiple Servers.

templateURL

The URL of the template page.

Example: templateURL=/en/email/newfund.jsp

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 http://server:port/... form of the URL, for example <img src="http://myserver:80/images/logo.gif> rather than <img src="images/logo.gif> and <a href="http://myserver:80/help/index.html>help</a> rather than <a href="help/index.html>help</a>.

mailingName

A name used to identify an e-mail campaign

Default: Tuesday meeting

messageFrom

“From” field of the e-mail message

Default: management@example.com

messageTo

A single e-mail address that overrides the emailAddress property of the target profile

Default: test@example.com

messageReplyTo

“Reply to” field of the e-mail message

Default: hrgroup@example.com

messageCc

“Cc” field of the e-mail message

Default: bill@example.com

messageBcc

“Bcc” field of the e-mail message

Default: some-one@example.com

messageSubject

“Subject” field of the e-mail message

Default: Mandatory Meeting, Tuesday at 3:00

messageAttachments

Any files to attach to the e-mail message

Default: E:/mailattach/agenda.doc

contentProcessor

MessageContentProcessor responsible for processing the message content

Default: /atg/userprofiling/email/HtmlContentProcessor

fillFromTemplate

Overrides the properties set in a JHTML or JSP file and fills the e-mail with values from an e-mail template

Default: true

siteId

(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.


Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices