Skip to main content
This plugin is in beta and may not be stable.
The Inbound Better Auth plugin automatically sends transactional emails for important authentication events like password changes, new device sign-ins, and account creation.

Installation

The plugin is included in the inboundemail 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:
Then import and use the pre-built templates:

Available Templates

Authentication Templates

Organization Templates

Social Account Templates

Customizing the Design System

The betterAuthDesignSystem export provides a complete design token system you can use for consistent styling:
You can override these tokens when creating your own templates:

Custom React Email Templates

Create your own templates using @react-email/components:
Then use it in your plugin configuration:

Disabling Events

To disable specific events:

How It Works

The plugin uses Better Auth’s after hooks to intercept successful authentication operations:
  • Password changes: Hooks into /change-password endpoint
  • Email changes: Hooks into /change-email endpoint
  • 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
New device detection works by tracking unique combinations of IP address and user agent per user. The first sign-in from a new device/browser triggers a notification email.

TypeScript Support

All types are exported for full TypeScript support: