Fix email system not building the template correctly