Run custom function prior to using email template

Run custom function prior to using email template

Hello,

I have a custom function that queries a related list and populates a field called "Assets" in the Contact, e.g., gathers the serial numbers of the owned Assets by the Contact and populates a field called "Owned Assets" which is a string.

I also have an email template that inserts the "Owned Assets" string into the template that I send to the Contact.

Is it possible to automatically run the custom function whenever that template is used so that I don't have to make this a 2-step process?

Thanks!