Setting the E-mail Encoding

When you send targeted e-mail, you must make sure the character set used is supported by the most popular e-mail clients. For example, Japanese JSP templates are stored by default in the SJIS character set (on Windows) or the EUC character set (on UNIX). These are 8-bit encodings, while the default encoding for most Japanese e-mail clients is the 7-bit ISO-2022-JP character set. You can configure an Oracle ATG Web Commerce application to send e-mail in the ISO-2022-JP encoding.

The TemplateEmailSender component can translate e-mail messages to different encodings for transmission. For example, you can specify that SJIS and EUC should be translated to JIS.

To specify the mapping between the template encoding and the message encoding, set the emailEncodingMap property of the TemplateEmailSender component used to send out the e-mail. This property is a Hashtable that can list any number of mappings. For example, the default setting of this property is:

emailEncodingMap=SJIS=iso-2022-jp,EUC=iso-2022-jp

This setting specifies that if the template uses either the SJIS or EUC character set, the resulting e-mail messages should use the ISO-2022-JP character set. (ISO-2022-JP is the IANA/MIME equivalent name for the JIS Java charset.) You can change these mappings, or append additional mappings of the form template-encoding=message-encoding (separated by commas).

You can use either the Java charset or the IANA/MIME names for the character sets. Typically, the template encoding is specified by its Java charset name and the message encoding is specified by its IANA/MIME name. (The default setting shown above uses this convention.) If you specify the Java charset name for the message encoding, TemplateEmailSender uses the equivalent IANA/MIME name in the message header.