Templates

The email templates used for email notifications, for generating the digest of an activity, and for sending passwort change requests can be defined in the Templates section of the System Settings. Here, additionally, custom templates can be created that can then be used as subtemplates in mailings or email templates.

Every template below can be filled with pure text or Liquid code or a mixture of both.

Notification

The WebCRM can send a notification email after a comment has been added to an activity.

  • notification_email_to: Lets you specify the recipient email addresses (separate addresses with a comma). Example:

    {% if activity.contact %}{{activity.contact.email}}{% endif %}

  • notification_email_from: One of the predefined sender addresses.
  • notification_email_reply_to: Address to which replies to the sent emails are to be sent.
  • notification_email_bcc: Recipient addresses for blind copies.
  • notification_email_subject: Email subject
  • notification_email_body: Contents of the email

The following example for notification_email_body illustrates how the contact person and the latest comment of an activity can be accessed. This template includes another template, contact_salutation, which calculates the form of address for the person.

{% assign contact = activity.contact %}{% include "contact_salutation" %} a comment has been added to your request "{{ activity.title }}": {% assign comment = activity.comments.last %} --- Comment date: {{ comment.updated_at | date:"%Y-%m-%d, %H:%M" }} --- {{ comment.notes }} --- End of comment --- Sincerely, Your Services Company

Next to the login of the author of a comment (comment.updated_by), the individual comments also include the author as a person (comment.contact), unless the person has not been specified as the comment was saved. This enables you retrieve the author’s details such as their full name (comment.contact.first_name and comment.contact.last_name).

The contact_salutation template has the following contents:

{% assign salutation = '' %} {% case contact.language %} {% when 'en' %} {% if contact.gender == 'N' %} Dear Sir or Madam, {% else %} {% case contact.gender %} {% when 'M' %}{% assign salutation = 'Mr. ' %} {% when 'F' %}{% assign salutation = 'Mrs. ' %} {% endcase %} {% if contact.name_prefix %} {% capture salutation %}{{contact.name_prefix}} {% endcapture %} {% endif %} Dear {{salutation}}{{contact.last_name}}, {% endif %} {% when 'de' %} {% if contact.gender == 'N' %} Sehr geehrte Damen und Herren, {% else %} {% case contact.gender %} {% when 'M' %}{% assign salutation = 'Sehr geehrter Herr ' %} {% when 'F' %}{% assign salutation = 'Sehr geehrte Frau ' %} {% endcase %} {% if contact.name_prefix %} {% capture salutation %}{{salutation}}{{contact.name_prefix}} {% endcapture %} {% endif %} {{salutation}}{{contact.last_name}}, {% endif %} {% endcase %}

The template for notification_email_to should only return an email address if the new comment is to be published:

{% if activity.comments.last.published %} {{activity.contact.email}}{% endif %}

Sending the history of an activity

Analogous to notification emails, the emails for sending the history of an activity can be configured by means of the following fields:

  • digest_email_from
  • digest_email_reply_to
  • digest_email_bcc
  • digest_email_subject
  • digest_email_body

The email recipients cannot be configured since they can be specified in the user interface of the WebCRM.

Here is an example for digest_email_body:

Activity data: -------------- Title: {{activity.title}} Kind : {{activity.kind}} State: {{activity.state}} Contact data: -------------- {% if activity.contact %} Name : {{activity.contact.last_name}} {{contact.first_name}} Email: {{activity.contact.email}} {% else %} No contact data present {% endif %} Comments: -------------- {% for comment in activity.comments %} {% if comment.published %} {{comment.updated_at | date:'%Y-%m-%d %H:%M'}} - {{comment.updated_by}} -------------------------------------------------------- {{comment.notes}} {% endif %} {% endfor %} ------------------------------------------------------------------------

Sending the URL for password change

The instructions with which a WebCRM person can change their password are sent to this person’s email address using the following configuration values:

  • password_request_email_from
  • password_request_email_reply_to
  • password_request_email_bcc
  • password_request_email_subject
  • password_request_email_body

Here is an example for password_request_email_body (assumes that a template named contact_salutation exists):

{% include "contact_salutation" %}, {% if contact.language == "de" %} bitte öffnen Sie die folgende URL in Ihrem Browser, um Ihr Passwort zu setzen: {{password_request_url}} Sollten Sie die Änderung Ihres Passworts nicht angefordert haben, können Sie diese Email ignorieren. Ihr Passwort bleibt dann unverändert bestehen. {% else %} to reset your password, please open the URL below in your web browser: {{password_request_url}} If you did not request your password to be reset, please ignore this email. Your password will then remain as it is. {% endif %}

Liquid filters

Next to the filters offered by Liquid, the WebCRM includes the in_time_zone filter, which transforms a date/time value to the specified time zone. The filter accepts as its argument any time zone name from the Ruby TZInfo module. Example:

{{activity.updated_at | in_time_zone: "Europe/Berlin" | date:'%Y-%m-%d %H:%M'}}