Decode Base64 In Custom Field When Sending Emails

I’m saving base64 encoded html in a custom field via the API. I’m looking to add the custom field to a email template and it decode the Base64 when sending emails.

This extension seems to be what i’m looking for, but the author said he will not be upgrading it to M3.

I have this working when sending emails via a API by adding a prefix to the base64 string…

case “cb64de://”:
$value = base64_decode(substr($value, 9));

But cant seem to find where to hack the code for sending email via a template.

Any help is appreciated!