Encoding for e-mail transmission

For e-mail transmissions where the content must be encoded, the various messaging commands choose the encoding based on the following hierarchy:


About this task

The outbound messaging task command (SendMsgCmd) uses the messaging system object (Messaging) to create and send messages. The encoding selection hierarchy depends on whether the messaging task command specifies a Member_ID (CmdSendMsg.addMember(getUserID) or not.


Procedure

To illustrate the concept of JSP composition template and the various globalization capabilities of the outbound messaging system, the following is an end-to-end example about how to implement a globalization enabled e-mail messaging command:

  1. Initialize com.ibm.commerce.messaging.commands.SendMsgCmd in your command implementation in order to create a message:

      com.ibm.commerce.messaging.commands.SendMsgCmd sendMsgCmd =
      (com.ibm.commerce.messaging.commands.SendMsgCmd)
      CommandFactory.createCommand(SendMsgCmd.NAME, getStoreId());

    The getStoresJS method creates a JavaScript array with all information entitled to the user according to the access control policy. The information includes the stores that the user is entitled to access, the fulfillment centers of those stores, and the languages supported by each of the stores. The following is an example of a JavaScript array created by a call to the getStoresJS method:

  2. Retrieve the translated subject of the message:

      Locale locale = getCommandContext().getLocale();
      ResourceBundle property = (ResourceBundle)
      ResourceBundle.getBundle("yourPropertyFile", locale);
      String subject = property.getString("SUBJECT_CONTENT");

  3. Pass in the translated subject line with the setConfigData method defined in SendMsgCmd:

      sendMsgCmd.setConfigData("subject", subject);

  4. Retrieve the translated content of the message:

      // assume we are using storeId 1
      sendMsgCmd.setStoreID(new Integer(1));
      // the default Message Type ID for Password Reset Notification view
      name is "PasswordNotify" (that is MSGTYPES.NAME).
      sendMsgcmd.setMsgType("PasswordNofity");
      // pass the viewName, commandContext and TypedProperty to compose
      the
      message
      // the default MSGTYPES.VIEWNAME of Password Reset Notification is
      PasswordNotifyView. If null is specified, the default view name
      will be used. A different view name can be specified.
      sendMsgCmd.compose("PasswordNotifyView", getCommandContext(),
      typedProperty);

  5. Create the view JSP of your command as follows:

    1. Retrieve the locale as shown in the following:

        ...
        <c:set var="localeOwn" value="${CommandContext.locale}"/>
        ...
        <html>
        ...
        ...
        <param name="LOCALE" value="${localeOwn}"/>
        ...
        ...
        </html>
        

    2. Retrieve the corresponding properties file and get the translated text to generate the content of the message:

        ...
        <c:set var="locale" value="${CommandContext.locale}"/>
        ...
        <fmt:setLocale value="${CommandContext.locale}" />
        <fmt:setBundle basename="${path}PasswordResetNotification"
        var="bnResourceBundle" />
        ...
        ...
        <title><fmt:message key="eMarketingSpot_UpSellCrossSell"
        bundle="${bnResourceBundle}"/></title>
        


Results

The JSP associated with your view command generates the globalization enabled message to be delivered to the outbound messaging queue (temporarily stored in MSGSTORE table).

The following table shows examples of message types that use message composition templates. You can use these templates and their associated commands as a reference when building our own messaging commands and composition templates.

Message type JSP template Path
OrderCreateXMLFormat OrderCreateXML.jsp workspace_dir\Stores\Web Content
OrderStatusNotify OrderStatusNotify.jsp workspace_dir\Stores\Web Content
PasswordReset PasswordResetNotification .jsp workspace_dir\Stores\Web Content


Related concepts
WebSphere Commerce configuration file (wc-server.xml)
Outbound messaging system
Globalized catalog content
Cultural considerations
Localized store assets
Globalization in the messaging system
Programming models for globalized stores
Globalized store design
Supporting globalization
Globalized tools framework


Related tasks
Creating a globalized store


Related reference
Globalization tips