When setting a custom email HTML template through the UI, there is no validation on the input (eg. wrong or missing variables). This seems to lead to the template breaking and either defaulting to the plaintext template or breaking the whole flow if both templates fail, and its difficult to debug. I think adding validation when setting the email templates would go a long way at avoiding these errors early.