Email templates
4 minute read
Templates are listed by name and slug on the Templates tab of Admin > Email Settings.
Edit a template
On the Templates tab, select the pencil icon in the template’s row. Each template has the following fields:
| Field | Description |
|---|---|
| Subject | The subject line, rendered with the context the sender passes in. |
| From address | A sending address, written as Full Name <email@address>. Leave empty to use the default from Email Settings. |
| CC Addresses, BCC Addresses | Comma-separated addresses copied on every email from this template. |
| Body | The HTML body, rendered with the context the sender passes in. Omit <html> and <body> tags, as these are supplied by the wrapper described below. |
| Text body | The plain-text body. If left empty, CMP strips the tags from the HTML body and uses the result. |
For example, to drop the rate from the Order Complete email, find this block in the Body field:
{% for server in order.prov_server_list %}
* Hostname: {{ server.get_vm_name }}{% if server.ip %}
Primary IP: {{ server.ip }} {% endif %}{% if server.rate %}
Rate: {{ server.rate_display }}{% endif %}
{% endfor%}
And change it to:
{% for server in order.prov_server_list %}
* Hostname: {{ server.get_vm_name }}{% if server.ip %}
Primary IP: {{ server.ip }} {% endif %}
{% endfor%}
Use the New Email Template button on the Templates tab to create a new template. Templates you create can be edited and deleted; the built-in ones can only be edited.
Built-in templates
| Name | Slug | Sent when |
|---|---|---|
| API Token Expiration Warning | pat-expiration-warning |
A user’s API token is nearing expiration. |
| Attached Report | attached-report |
Someone emails a report from the report page. |
| AWS Missing Tags | aws-missing-tags |
The rule for AWS servers missing required tags runs. Goes to each server’s owner. |
| Continuous Infrastructure Testing failure | cit-failure |
A Continuous Infrastructure Testing job fails. |
| Email Change Confirmation | email-change-confirmation |
A user changes the email address on their profile, to verify the new one. |
| Error synchronizing user permissions | user-sync-failure |
An LDAP user synchronization job fails. |
| Expired Server | expired-server |
The Email Owners of Expired Servers action runs and lists each owner’s expired servers. |
| Export Group Servers Report | export-group-servers-report |
A per-group server export is emailed to that group’s admins. |
| Export Servers Report | export-servers-report |
A server export is emailed to the addresses you named. |
| Group Quota Warning | group-quota-warning |
A group passes a quota threshold. Goes to members who can manage subgroup quotas. |
| Job failure | job-failure |
A sync job or a monitoring command fails. Goes to the CB Admin address. |
| License Warning | license-warning |
The license rule finds usage past a threshold. |
| Order Complete | order-complete |
An order finishes. Goes to the order owner. |
| Order Complete for Recipient | order-complete-for-recipient |
An order that names a recipient finishes. |
| Order Created | order-created |
An order has been submitted and requires approval. Goes to the group’s approvers. |
| Order Reminder | order-reminder |
Someone clicks Send Reminder on an order awaiting approval. |
| Password Recovery | password-recovery |
A user requests a password reset. |
| Stale Job Report | stale-job-report |
The stale job check finds jobs that have run past their limit. |
| Upgrade Notification | upgrade-notification |
CMP reports on an upgrade. Goes to the CB Admin address. |
Branding and the wrapper
The Body of each template is rendered within a base HTML template that includes a header image, a footer link, and CSS to ensure the message renders correctly across email clients. When an email is sent in the context of a web request, it is branded with the portal for that request’s domain. The header image is set on the portal, and the background color on the theme assigned to it.
Not every email has a request behind it. Anything sent from the job engine uses the default portal’s branding.
To replace the wrapper, create a file at /var/opt/cloudbolt/proserv/templates/emailtemplates/base.html. Your file must include the {{ email_body }} variable, and the <html> and <body> tags that individual templates omit:
{% load helper_tags %}
{{ email_body|safe|linebreaks }}
Sent from {% portal_link %}
Related
- Email: SMTP settings, the default From address, and the administrator alert address.
- Send email manually: Sending a template from your own plugin or action.