Setting Up E-Mail Templates
Business portals use 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 that enable dynamic integration with data, such as incorporating the username into order-related communication. Additionally, this feature supports multilingual capabilities, allowing emails to be sent in the user's preferred language.
Creating a New E-Mail Template
Follow these steps to create the basic data for the email template and make it available throughout the business portal wherever the email template is used.
To create a new email template, follow these steps:
- Click on Portal Setup in the ribbon bar of the Business Portals role center.
- Navigate to E-Mail Templates.
- Click 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 short description of the email template. This field is only visible to the Business Central user.
- Select an appropriate source table under Source Table.
- To be able to select a suitable template in the module setup under E-Mail Configuration, the Source Table must be set to DPS_User (5138165).
Adding Template Content
The content of the email template must then be provided. This content will be used by the system and sent to the appropriate user.
To add the template content, follow these steps:
- In the Lines section, click on the Language Code field to select the language for the email template. All configured languages are available in the dropdown menu.
- Fill in the Subject field with the subject of the email.
- The body text of the email template must be created outside of Business Central by generating an HTML document. This approach allows the use of full HTML formatting within the email, enabling a wider range of formatting options such as italics, bold, underline, images, and more.
- After the HTML text is prepared, click on Import to open a pop-up window. There, you can either click to open a file explorer and select the desired file or drag and drop the HTML file directly into the pop-up window.
- After uploading the HTML file, the Template Imported field will be automatically checked.
Tip
It is highly recommended to create an email template for each configured language. This ensures that the user receives the email in their preferred language when they select it.
Exporting an E-Mail Template
The email template can also be exported to easily review its contents or modify an existing template without creating a completely new one.
Using Placeholders
Placeholders can be used within the email template to dynamically insert data, such as the username, 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:
- Select a source table.
- Click on the E-Mail Placeholders action to open the placeholder list.
- The placeholder text will be automatically generated, such as %1, %2, %3, etc. These placeholders can be copied and pasted into the content of the email template.
- Select a field name using the lookup function that 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 username. When the email is sent, the placeholder %1 will be replaced with the actual name of the user. This can be achieved by selecting User as the source table and choosing the field name Username for %1 in the placeholder list. This ensures that %1 in the email template is replaced with the actual username.