Posted: July 13, 2020 at 7:41 pm
I would like to be able to apply custom emails to an entire category of events, rather than a single event at a time. Is there a way I can do this, whether it’s via add-on, or custom code, or anything? Thanks for your help.
There’s a couple of ways you can do this and whilst it’s not something we can support and can help point you in the right direction.
(Note – both of these options require custom code as we don’t have anything in core that can do it for you)
Option 1 – Hook into the function used to generate the email data and set the send_email and email_id property of the event on the fly.
There’s a within EE3 ‘fired’ just after EE has prepped all of the data it will use for the email which is
So you could hook into that, pull the event ID from
Take a look in
This is the easiest option but adds an additional query to each and every email as it needs to check the category each time.
Option 2 – Update the event’s within the database to use custom email.
Within each event record there is a
So if this is a one time update you could write some custom code to pull all of the events in said category, loop over each and update the 2 fields above. Depending on the number of events this may need to be done in batches.
This is a little more involved but you only need to run the query to update the events once, not every time an email is generated.