E-mail module with templates
Overview
Send e-mails with or without templates using this module. E-mail templates can be managed using tokens, allowing for attributes and references of an object to be filled in automatically and correctly. You can configure your account to authenticate with Microsoft Azure AD OAuth 2.0.
<Note: As part of the move to Community Support this module is freshly onboarded to Marketplace resulting in unintentional loss of release version history. This is E-mail module with templates' version 11.2.0 Published on 10th Aug 2022>
Check out platform supported Email Connector module as it supports sending emails using templates, sending encrypted & signed emails, and also supports shared mailbox.
Documentation
1 Introduction
[Email Module with Templates] lets you send emails with templates. Email templates can be managed with the possibility of using tokens. With the tokens available in the email template, the attributes and references of an object are filled in automatically and correctly.
1.1 Typical Use Cases
The typical usage scenario is sending emails with a template system and using tokens to handle all of your outgoing standard emails.
1.2 Dependencies
- Mx Model Reflection
- Encryption
2 Configuration
To configure this module, follow these steps:
1. Download the [Mx Model Reflection] module from the Mendix Marketplace.
2. Download and configure the [Encryption] module from the Mendix Marketplace.
3. Add the Administration snippet to a custom page in a different module.
4. View the example in the USE_ME > Examples folder.
5. Create a duplicate of this example in your own module and customize it to make it fit your needs:
* `Sub_CreateAndQueueEmail` – This is preferred for normal environments and will send the email in the background using a scheduled event.
* `Sub_CreateAndSendEmail` – This is preferred for [Free App](/developerportal/deploy/mendix-cloud-deploy/) environments and sends an email directly. This approach will block the user's flow and does not include a retry when the sending fails.
* `Post-deployment` – After deploying, you have to set up your email settings and insert your own email templates using the newly created navigation items under Administrator
6. Go to `MxObjects_Overview` and synchronize the objects. Make sure you do this every time you have added new objects.
2.1 Security
For security reasons, it is highly recommended for the Server configuration to set the Use SSL option in combination with Use SSL check server identity:
* If you incorporate the Administration snippet, make the configuration on the Configuration tab:
* If you set up the module using the wizard, make the configuration in the wizard:
3 Usage
3.1 Configuring Microsoft Azure Active Directory (AD) OAuth 2.0
You can configure your account to authenticate with Microsoft Azure AD OAuth 2.0. You can only add one OAuth 2.0 configuration for each app.
Select the checkbox for Microsoft Azure AD. If the account is already registered on the Azure portal, the required fields will already be filled in. If not, or if you need to make changes, you will need to register your app on the Azure portal.
3.1.1 Using OAuth Path Constants
* The OAuthCallbackPath constant is used to configure a redirect URI to acquire an authorization code from an OAuth provider.
* The OAuthSignInPath constant is used to start an OAuth flow.
3.1.2 Registering Your App on the Azure Portal
To register your app, follow Microsoft's [Tutorial: Register an app with Azure Active Directory](https://docs.microsoft.com/en-us/power-apps/developer/data-platform/walkthrough-register-app-azure-active-directory).
While registering, set the redirect URI to `https://(yourapp_domain)/(Value_of_OAuthCallbackPath_Constant)/azure`. For example, if the domain name is www.example.com and the value of the Constant OAuthCallbackPath value is "callback_et/" then redirect URI will be `https://www.example.com/callback_et/azure`
3.1.3 Enable Permissions in the Azure Portal
On the [Azure portal](https://portal.azure.com/), ensure that you have the permissions enabled under API permissions tab on the sidebar:
3.1.4 Client ID, Tenant ID, and Client Secret
The Email Module with Templates requires a Client ID, Tenant ID and Client Secret. These will be available on the [Azure portal](https://portal.azure.com/) once you have registered your app.
3.1.5 Configure After-Startup Microflow
To configure the After-Startup microflow in Studio Pro, do the following:
1. In the App Explorer, go to Settings and open App Settings.
2. Go to the Runtime tab.
3. In After-Startup, select the ASU_RegisterHandlers microflow.