How to send emails with tokens using Email Connector | Mendix 10 (banner Image)
How to send emails with tokens using Email Connector | Mendix 10

How to send emails with tokens using Email Connector | Mendix 10

Mendix Community
Published in
7 min readSep 19, 2023


Prerequisites Marketplace modules

Before starting the tutorial, make sure that you have the Mx Model Reflection module installed in your project. If you don’t have it, you can install it using the following links.

Step by Step

1- Download the Encryption module from the marketplace

2- Go to your application Settings and select the active configuration. Under the Constant tab, add an EncryptionKey with a random string of 32 characters. You can generate this Key in a Password Generator website.

3- Currently in this project, we have 2 entities: Request and File. The File entity should be a generalization of System.FileDocument.
There are also 2 pages: Request_Overview and Request_NewEdit. Inside the NewEdit, we have a File Dropper widget. This widget can be found on the marketplace.

Entities in domain model
Request_Overview Page
Request_New Edit with FileDropper widget

4– You can check the properties below if you also want to implement this widget in your project, but a default file upload widget will work out of the box.

5- In the project security, go to User Roles and give your Administrator permissions to the modules MxModelReflection and Encryption

6- Download the module Email Connector from the Marketplace

7- If an error regarding an outdated widget definition occurs you can Update the widget by right-clicking on it and selecting ‘Update all widgets

8- In the Navigation, add 2 items.
Model Reflection: MxModelReflection.MxObjects_Overview (Page)
Email: Email_Connector.ACT_EmailAccount_LaunchEmailConnectorOverview (Microflow)

9- Give Administrator permissions to the Email_Connector Module in the Application Security Overview.

10- Run the project

11- Go to the Model Reflection page, select the following modules and ‘Click to Refresh’:
- Email_Connector
- EmailTutorial (MainModule)
- MxModelReflection

12- Now click on the ‘Email’ page and start the wizard. On the first step, select ‘Use Basic Credentials’.

13- Because we are doing this tutorial locally, it is necessary to emulate an SMTP server locally. To do this, we are going to download an app called ‘FakeSMTP’ (

14- After downloading, open the app and click on ‘Start Server

15- On the Second Step, fill in the fields needed.
Note: Passwords do not need to be correct if you are using the FakeSMTP app.

16- On the Third Step, select ‘Send Emails’ and as a ‘Protocol’ select SMTP.
Server Host should be ‘localhost’ and the Server Port ‘25’.
If all went well a popup should appear saying ‘Email Account Added

17- On the top right, click on the ‘Email Template’ button. Create a new template and fill in the following fields:
- Template Name: ‘RequestSubmit’
- From Address: ‘’
- To: ‘’
- Subject: ‘RequestSubmit’

18- In the Placeholder section, select as an entity the ‘Request’ table.

19- New tokens for each attribute as you can see below.

20- On the HTML Preview, fill the text area with the text you want. Make sure that you use the Tokens as in the example.

21- Go to the ‘Plain text’ tab and click on the ‘Copy from HTML text’ button

22- On the NewEdit page, change the on-click event of the Save button and call a microflow. Create a new microflow called ACT_Request_SaveWithEmail.

23- Drag and drop a Retrieve Action and fill it with the same information of the image.

24- In the app explorer, search for the Email_Connector module -> USEME -> Sample and duplicate the microflow called ‘Sample_ACT_CreateEmailFromTemplateAndThenSend’.
Move the duplicated microflow to your main module.

25- Rename the microflow to ‘SUB_CreateEmailFromTemplateAndThenSend’

26- Modify the EmailAccount Parameter to a Request parameter

27- Add to the ACT microflow the SUB microflow and fill in the arguments.

28- Inside the SUB microflow, check the first Java action. Select the $Request object as a Data object and the $EmailTemplate object as an EmailTemplate

29- Change the retrieve list action to get the $Request/File_Request

30- In this case, you can remove these actions because we are already getting the attachment associated with the Request object.

31- On the ACT microflow, commit the Request object and close the page.

32- Give User permissions to the microflow.

33- Rerun the project and on the homepage create a new Request object.

34- If all goes well, you will see a new email on the list.

This is the end of the tutorial.

You can ask questions, help other people, and have access to all the tutorials.
If you want to be part of this community, you can do so through this invite.

From the writer

If you enjoyed this article you can find more on our Medium page. For great videos, you can visit our YouTube page.

Are you interested in getting more involved with our community? I’m creating a Mendix community on Discord to make life easier for devs.

From the Publisher -

Inspired by this article to bring your ideas to life with Mendix? Sign up for a free account! You’ll get instant access to the Mendix Academy, where you can start building your skills.

For more articles like this one, visit our Medium page. And you can find a wealth of instructional videos on our community YouTube page.

Speaking of our community, join us in our Slack community channel. We’d love to hear your ideas and insights!



Mendix With Me
Mendix Community

Ricardo Pereira: Certified Mendix Expert from Portugal 🇵🇹 | Founder of Mendix With Me community | Join us on Discord: