Custom Email Templates
When having users interact with Managed IoT Cloud there are certain scenarios that require an email to be sent. Since there is a possibility for a user to have a specific locale set, there is also a possibility to change the email template used. This guide will help you to create your own custom email template for the locale of your liking.
Email templates
There are several different templates that can be changed. These custom templates are stored as .HTML
files using the File API. For every template there is a subject
and a body
file. You can have localized templates for all of your domains.
Available templates
Below is a table of the available templates that are customizable. They have some required template tags that need to be included in the template in order for the email to have all correct information.
Template Name | Description | Required Template Tags |
---|---|---|
CustomMessage_AdminCreateUser |
This template is used when the administrator creates a new user. The email is then sent to the newly created user. | ${userName} , ${link} |
CustomMessage_ForgotPassword |
This template is used when the user requests to get a new password. | ${userName} , ${link} |
CustomMessage_SignUp |
This template is used when a new user creates their new account. An email is then sent to the user with a confirmation link to activate their new account. | ${link} |
CustomMessage_ResendCode |
This template is used when a new user requests a new activation link. An email is then sent to the user with a confirmation link to activate their new account. | ${link} |
CustomMessage_UpdateUserAttribute |
This template is used when a user email is changed. An email is sent to the old email address stating to login and verify that the new email is correct. | ${userName} , ${link} |
New_User |
This templates is used when a new user is created and it needs to be activated by the administrator. This email is sent to the administrator. NOTE: This can only be customized in en-US and in the root domain, since this sends one email to multiple recipients. |
${userName} , ${link} |
Welcome_Message |
This template is used when the user is completely activated and able to login. | ${userName} , ${link} , ${email} |
Template file structure
As the files are stored in the public storage, you as a developer need to create two files and upload them onto a certain location. Below is a list of the available templates.
Example template for CustomMessage_AdminCreateUser
Type | File Name | Content |
---|---|---|
Subject | CustomMessage_AdminCreateUser.subject.html |
Welcome to Managed IoT Cloud! |
Body | CustomMessage_AdminCreateUser.body.html |
<p>A new user account with username ${userName} has been created for you on the Managed IoT Cloud platform.</p><p>To activate the user account, you need to set a password at ${link} within 7 days.</p><p>Please note that you cannot respond to this mail.</p> |
To have this template uploaded and used for a certain locale, the path is built up as:
custom_email_templates/<domainId>/<locale>/<template_name>.<type>.html
<domainId>
: Under what domainId you want to place the template. This is a flat structure since domainId is unique for your environment. Use the Domain API to find your domains.<locale>
: This is an ISO639‑1 language code in lowercase and an ISO3166‑1 country code in uppercase, separated by a dash. For example,en-US
orsv-SE
.<template_name>
: One of the template names described in the table of available templates<type>
:body
|subject
Custom Styling
Since the emails are sent as HTML and not plain text you can have custom styling included in the email as well as images, however, this hasn’t been tested thoroughly so use with care and test that the templates works as expected before releasing them to all of your users.