I have a Microsoft Access application that stores email template data within a table. Then, with the use of VBA, an email can be sent based on the form’s record (see simplified example of the table below).
As you can see, the fields to be modified according to the form data (identified by square brackets) differ depending on the purpose of the email message.
What I envision is a pop-up form that allows the user to choose the recipient type, which then filters the repeating group to the recipients that match that selection, and then the user will click on the link icon, which will open a mailto link that has been populated with the data represented by the link’s record (see example below).
I would create an optionSet for this. The displays for the options would be the human readable texts : Agency, Staff, 3rd Party etc… Then create an attribute that is the formData key [[agencyEmail]], [staffEmail]]… etc. Use these options to populate the ‘choose recipient’ repeating group, but when a user selects one of them, use the option’s form data attribute as a search constraint for the email templates repeating group.
You can use ‘find & replace’ operator to identify the form data and replace it with their corresponding dynamic values.
You could use a bulk ‘find & replace’ plugin that allows you to enumerate all the form-data & their corresponding dynamic fields. You would have to enumerate all the form datas, even the ones that are not present in your email template.
If you have less than a hundred form data types, this simple solution works just fine. If you have more, or you want to let users generate their own, then you might need another solution.