The TemplateEmailInfoImpl’s contentProcessor property points to a MessageContentProcessor object, which is responsible for actually setting the e-mail message content given the rendered message body. Implementing this functionality in a separate class allows you to implement different schemes for processing content.
MessageContentProcessor is an abstract class. The Personalization module includes two concrete subclasses of MessageContentProcessor: SimpleContentProcessor and HtmlContentProcessor. You can also implement your own content-processing scheme by creating a subclass of MessageContentProcessor that implements all of its methods.
SimpleContentProcessor
SimpleContentProcessor doesn’t do any processing on the passed-in message content but simply uses the content as is to set the javax.mail.Message content. The MIME type of the content in the Message is specified by the service’s contentType property. For instance, if contentType is “text/html,” the rendered page is sent as HTML; if the contentType is “text/plain,” it will be sent as simple text (no word wrapping).
HtmlContentProcessor
HtmlContentProcessor is a more sophisticated implementation of MessageContentProcessor. The HtmlContentProcessor does the following:
Takes in content of type “text/html”
Optionally, converts it into content of type “text/plain”
Performs word wrapping on the plain text version of the content
Determines whether to send the
Messagecontent as “text/html”, “text/plain”, or “multipart/alternative” with “text/plain” and “text/html” parts
You can configure the HtmlContentProcessor with the following properties:
Property | Function | Default |
|---|---|---|
| If true, send message as HTML; if | true |
| If true, send message as plain text; if | true |
| Indentation width used in text/plain version of message. | 5 |
| Line width used in text/plain version of message. | 70 |
| Character to use to create horizontal rules in text/plain version of message. | - |
| Character to use to introduce list items in text/plain version of message. | - |
HtmlToTextConverter
If the sendAsText property in HtmlContentProcessor is true for a given e-mail message, the Personalization module uses an instance of the class atg.userprofiling.email.HtmlToTextConverter to convert the message to plain text. Note, however, that the converter supports the conversion of content included in the following HTML tags only:
title
h1
h2
h3
h4
h5
h6
p
br
hr
blockquote
pre
ul
ol
li

