Installation
The plugin is included in theinboundemail package in version 0.20.0 and above. You’ll also need better-auth installed:
Quick Start
Server Setup
Client Setup (Optional)
For proper type inference on the client side:Supported Events
The plugin automatically sends emails for these authentication events:Configuration Options
Custom Templates
You can customize the email content for any event type:Template Context by Event Type
Each event type receives different context data:password-changed
email-changed
new-device-sign-in
account-created
password-reset-requested
two-factor-enabled / two-factor-disabled
Organization Events
These events are triggered when using Better Auth’s organization plugin.organization-invitation-sent
Sent to the invitee when they are invited to join an organization.
organization-invitation-accepted
Sent when a user accepts an organization invitation.
organization-member-removed
Sent to a user when they are removed from an organization.
organization-role-changed
Sent when a member’s role in an organization is updated.
Social Account Events
These events are triggered when users link or unlink social/OAuth accounts.social-account-linked
Sent when a user connects a social account (Google, GitHub, etc.).
social-account-unlinked
Sent when a user disconnects a social account.
Pre-built React Email Templates
The SDK includes beautiful, responsive React Email templates for all auth events. Install@react-email/components to use them:
Available Templates
Authentication Templates
Organization Templates
Social Account Templates
Customizing the Design System
ThebetterAuthDesignSystem export provides a complete design token system you can use for consistent styling:
Custom React Email Templates
Create your own templates using@react-email/components:
Disabling Events
To disable specific events:How It Works
The plugin uses Better Auth’safter hooks to intercept successful authentication operations:
- Password changes: Hooks into
/change-passwordendpoint - Email changes: Hooks into
/change-emailendpoint - Sign-ins: Hooks into
/sign-in/email,/sign-in/social,/sign-in/magic-link,/sign-in/passkey - Sign-ups: Hooks into
/sign-up/email,/sign-up/social - 2FA changes: Hooks into
/two-factor/enable,/two-factor/disable