Is your feature request related to a problem? Please describe.
I would like to have an option to copy/send certain transaction emails to an array of email addresses ( admins ).
Describe the solution you'd like
As an admin of the platform, I would like to be notified when someone creates an account, or places an order. At the moment, such transactional emails are sent to the recipient in context ( user ). As an admin, I would like a copy of the email ( preferably with an option to customize admin email templates ) sent to an array of email addresses.
Describe alternatives you've considered
Currently this you can implement on your own:
1) custom string (list) field for email addresses in global settings
2) either add admin addresses as recipients to customer emails (you can set multiple recipients by providing string of email addresses separated by comma e.g. "[email protected],[email protected]") or create custom email handler with custom template for admins
3) observe eventbus for any extra events you want to be notified about and trigger new email events there
You can retrieve the admin recipients in loadData method:
...
.loadData(async (context) => {
const settings = await context.injector
.get(TransactionalConnection)
.getRepository(GlobalSettings)
.findOne();
const recipients: string = (settings?.customFields as any).adminRecipients;
return { recipients };
})
.setRecipient((event) => event.data.recipients)
...
Thanks @chladog for your input! @azfx does this solve it for you? If so you can close the issue.
hi @chladog , thanks for the detailed solution, @michaelbromley, yes - that should definitely work, closing the issue!
Most helpful comment
Currently this you can implement on your own:
1) custom string (list) field for email addresses in global settings
2) either add admin addresses as recipients to customer emails (you can set multiple recipients by providing string of email addresses separated by comma e.g. "[email protected],[email protected]") or create custom email handler with custom template for admins
3) observe eventbus for any extra events you want to be notified about and trigger new email events there
You can retrieve the admin recipients in loadData method: