Customizing Email Templates

Customers can modify existing email templates or add new email templates that can be used to send emails from CloudPortal Business Manager.

Follow these steps to modify existing email templates:
  1. Log in to CloudPortal Business Manager UI a ROOT user.
  2. Navigate to Administration > Content Templates.
  3. Select the category of content templates that you want to modify.
  4. Select any template from the list of templates (in the left pane).
  5. Move the cursor over the manage icon (that looks like a gear wheel) and click Edit.

    A dialog box opens that contains the code for the template.

  6. Make the changes as required and click OK.

This modified template can now be used to send emails. This template gets persisted into the DB so it does not get reverted when CloudPortal Business Manager is re-started.

Adding new templates:

To add new templates, you must have the development setup as described in Installing and building custom components.

  1. Add new templates in liquibase xml file located in citrix.cpbm.custom.common bundle located at src/main/resources/citrix/cpbm/custom/db/portal/custom-db-config-v0.1.xml.

    A sample liquibase change set for adding a custom email template will look as follows:

  2. In code, an email template can be sent using emailService as shown below:
    /**     * @param template - the template location     * @param model - model object required for the template     * @param subjectKey - key code in messageSource for the subject     * @param user - user to him the email has to be sent     */    public void sendEmail(final String template, final Map<String, Object> model, final String subjectKey, final String[] toAddresses);      eg:    Map<String, Object> model = new HashMap<String, Object>();    model.put("locale", LocaleUtils.toLocale(config.getDefaultLocale()));    model.put("user", user);    emailService.sendEmail("SAMPLE_TEMPLATE", model, "email.template.SAMPLE_TEMPLATE.subject", <email addresses>);  
    Note: The above code uses the same value of template_name as provided in Step 1.

Stop emails sent with an email template

Service provider can choose not to send email associated with any email template by simply making the content of the email template as NULL or empty. When content of any email template is nullified, then the email is not sent and is ignored.

Note: Liquibase is a tool which CloudPortal Business Manager uses to populate base data or perform any upgrade or migrate operations during a CloudPortal Business Manager upgrade. More information about liquibase can be found at:
Vous avez d’autres questions ? Envoyer une demande