Setting Up Email Templates
Business Portals utilize emails in various scenarios, including user registration confirmation, multi-factor authentication (MFA), order confirmations, and more. The platform allows the creation of custom email templates, enabling dynamic integration with data, such as the inclusion of the user's name in order-related communications. Additionally, this feature supports multilingual capabilities, allowing emails to be sent in the user's preferred language.
Creating a New Email Template
These steps will be followed to create the base email template data, making it accessible throughout the entire Business Portal, wherever the email template is utilized. To create a new email template, follow these steps:
- In the Business Portals role center page, click on the Portal Setup in the ribbon bar.
- Navigate to the Email Templates.
- Click on the New button to create a new email template.
- Fill in the Code field with a unique code for the email template.
- The description field can be filled with a brief description of the email template. This field will only be visible to the Business Central user.
Adding the Template Content
The content of the email template must then be provided. This content will be utilized by the system and sent to the relevant user. To add the template content, follow these steps:
- On the Lines section, click on the Language Code field to select the language for the email template. All the configured languages will be available in the dropdown list.
- Fill in the Subject field with the subject of the email.
- The body of the email template must be created outside of Business Central, by generating a HTML document. This approach allows for the use of full HTML formatting within the email, enabling a wider range of formatting options, such as italic, bold, underline, images, and more.
- Once the HTML text is prepared, click on Import to open a pop-up window. From there, you can either click to open a file explorer, allowing you to select the desired file, or drag and drop the HTML file directly into the pop-up box.
- After the HTML file is uploaded, the field Template imported will be checked automatically.
Tip
It is highly recommended to create an email template for each configured language. This ensures that when a user selects their preferred language, they will receive the email in their chosen language.
Exporting an Email Template
The email template can also be exported, allowing for easy review of its contents or modification of an existing template, without the need to create a completely new one.
Using Placeholders
Placeholders can be utilized within the email template to dynamically insert data, such as the user's name, order number, or other relevant information. These placeholders will be replaced with the actual data when the email is sent to the user. To use placeholders, follow these steps:
- Choose a source table.
- Click on the Email Placeholder action to open the placeholder list.
- The placeholder text will automatically be generated such as %1, %2, %3, etc. These placeholders can be copied and pasted into the email template content.
- Choose a field name using the lookup function, which will be replaced with the actual data when the email is sent.
Example
For example, if the email template is for a user registration confirmation, the placeholder %1 can be used to insert the user's name. When the email is sent, the placeholder %1 will be replaced with the actual name of the user. This can be done by choosing User a source table, and in the placeholder list for %1, select the field name User Name. This will ensure that the %1 in the email template is replaced with the actual user name.