When using JavaMail Message
objects to send email, you must specify the MIME type of the message content. The Oracle Commerce Platform provides support for sending messages with content type of text/plain
and text/html
. If you need to send content that has some other MIME type, you must first register your content type with the JavaBeans Activation Framework (JAF), which JavaMail uses to handle message content.
For example, suppose you’d like to send messages with a MIME type of application/x-foobar
. To do this, you must provide an implementation of javax.activation.DataContentHandler
for your MIME type, say FoobarDataContentHandler
. You must then create a mapping between the MIME type application/x-foobar
and FoobarDataContentHandler
, so that JAF can use it.
One general way to register a DataContentHandler
with JAF is to provide a mailcap file with the appropriate content handler entry in it. Another way, which is Oracle Commerce Platform-specific but perhaps more convenient, is to configure the /atg/dynamo/service/DataContentHandlerRegistry
component to know about your content type and the associated handler. The dataContentHandlerMap
property of the DataContentHandlerRegistry
contains a list of mappings between MIME types and the associated DataContentHandler
class names. To register a new MIME type, simply add a mapping as follows:
dataContentHandlerMap+=\
application/x-foobar=package.name.FoobarDataContentHandler
See the API documentation for the javax.activation
package or the Oracle Web site for more information about JAF.