Did you check out the email with templates module https://marketplace.mendix.com/link/component/259
The documentation describes how to it can be implemented; https://docs.mendix.com/appstore/modules/email-with-templates