Hanko Custom Emails Guide:About Hanko:Hanko is a modern open source authentication solution and the fastest way you integrate passkeys, 2FA, SSO, and more—with full control over your data. Move between self-hosted and Hanko Cloud anytime. No lock-in. Just Auth how it should be: secure, user friendly, and fully yours.What This Guide Covers: This guide demonstrates how to implement custom email delivery for Hanko authentication flows. You’ll learn to disable Hanko’s default email service and handle authentication emails through your own email infrastructure and templates.Key Technologies:
This guide walks you through implementing custom email delivery instead of using Hanko’s default email service.
- Webhooks (email.send events)
- Email Service Providers
- HTML Email Templates
- JWT Token Processing
- Hanko Cloud Console
- Hanko Pro or Enterprise plan subscription
- Email service provider account
- Webhook endpoint development capability
- Basic understanding of email delivery systems
- JWT token processing knowledge
- Create webhook for email.send events
- Disable Hanko’s default email delivery
- Process webhook payloads for email data
- Design custom email templates
- Implement email sending logic
- Test custom email delivery flows
Create a webhook
Set up a webhook subscription for theemail.send event. This webhook triggers whenever Hanko needs to send an authentication email.
New to webhooks? Check out our comprehensive Webhooks guide first.
Disable email delivery by Hanko
This feature is only available in the Pro or Enterprise plans.
1
Access email delivery settings
Log in to Hanko Cloud, select your organization and project, then navigate to
Settings > Email delivery.2
Disable default email delivery
Set the
Email delivery setting to Off to disable default email sending.Send custom emails
When Hanko needs to send an email, theemail.send webhook event triggers with all necessary data for custom email delivery. The webhook token payload contains comprehensive email information:
'email.send' token payload example
'email.send' token payload example
data property contains type-specific information for email personalization. This structure varies based on the email type being sent (verification, password reset, etc.).
Use the webhook data to compose and deliver emails through your preferred email service provider or custom infrastructure, giving you complete control over email design and delivery.