My understanding is that state is a map of parameters passed into the template context by FusionAuth, not something you explicitly define in the template itself. If that snippet works even though you can't find a local declaration, it's likely being injected by the email rendering process. Have you checked the template variable documentation or tried outputting the contents of state to see which keys are actually available at runtime?