Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-3507

Allow HTML Emails for all emails sent out via CiviCRM


    • Type: New Feature
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 2.0
    • Fix Version/s: 3.1
    • Component/s: Core CiviCRM
    • Labels:


      1. We should use message templates to manage and maintain all emails sent by CiviCRM instead of using tpl files

      2. Make the following schema changes

      a. Add an option group for message_template_workflow
      b. Add option values for this group. This includes the following workflows (there probably are more)

      • contribution receipts including membership and pledge
      • event registrations receipts and messages from various workflows)
      • offline receipts for above
      • membership reminders
      • civimail mails
      • pledge reminders
      • PCP (and batch stuff)
      • tell a friend

      c. make the following changes to civicrm_msg_template

      • workflow_id - Pseudo FK to civicrm_option_value for above group
      • is_default - if this is the default message template for the above workflow

      The option_value.name will be the "key" used by the code to select the workflow_id value. In a future release we will probably support assignment of specific message templates to specific events / contrib pages - but for now we will always grab the "default" message template with the matching workflow_id for that "function" (e.g. Online contribution receipt).

      d. Admins will still be able to add content specific to a particular event or online contribution page - and we want to support both HTML and Text for this content. So, we need to add similar HTML columns to mimic the Text columns, e.g. : receipt_html in civicrm_contribution_page and confirm_email_html in civicrm_event. (there might be some more columns)

      3. Load all the text tpl's into message templates in civicrm_data. Create and load html tpl's also into the corresponding message templates (HTML versions should use simple HTML markup - you should be able to use markup patterns created for "front-end" pages under this issue - http://issues.civicrm.org/jira/browse/CRM-5084 - check w/ kyle at rayogram if you need more input).

      4. Modify all the mail code to retrieve and evaluate the email subject, text body and html body from the corresponding message template. Do civicrm token substitution first before doing the smarty fetch on the string. Check: CRM/Mailing/BAO/


      for code to evalute a template stored in a string (search for _SMARTY)

      5. Make the "mail" fields (receipt_text, confirm_email_text) in the contribution page config and event page registration config optional (since an admin could have modified the template directly). Also add input boxes for the newly introduced receipt_html and confirm_email_html

      6. Modify the message template screen(s) so users know what 'workflow' a template is being used for ("Used For" is a good label for this).

      Ensure that:

      • A message template can potentially be only text or only html or both. The code should account for this
      • We should also add code to do token substitution on the message templates
      • Centralize the message template retrieval, evaluate and send code




            • Assignee:
              sushant Sushant Paste
              lcdweb Brian Shaughnessy
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: