docs/self-hosting/auth/email.mdx
Email service is used for email verification, password reset, and magic link delivery. LobeHub supports two email service providers.
Send emails via SMTP protocol, suitable for users with existing email services. See Nodemailer SMTP docs.
| Environment Variable | Type | Description | Example |
|---|---|---|---|
EMAIL_SERVICE_PROVIDER | Optional | Set to nodemailer (default) | nodemailer |
SMTP_HOST | Required | SMTP server hostname | smtp.gmail.com |
SMTP_PORT | Required | SMTP server port (587 for TLS, 465 for SSL) | 587 |
SMTP_SECURE | Optional | true for SSL (port 465), false for TLS (port 587) | false |
SMTP_USER | Required | SMTP auth username | [email protected] |
SMTP_PASS | Required | SMTP auth password | your-app-password |
SMTP_FROM | Optional | Sender address (required for AWS SES), defaults to SMTP_USER | [email protected] |
<Callout type={'warning'}> When using Gmail, you must use an App Password instead of your account password. Generate one at Google App Passwords. </Callout>
Resend is a modern email API service with simple setup, recommended for new users.
| Environment Variable | Type | Description | Example |
|---|---|---|---|
EMAIL_SERVICE_PROVIDER | Required | Set to resend | resend |
RESEND_API_KEY | Required | Resend API Key | re_xxxxxxxxxxxxxxxxxxxxxx |
RESEND_FROM | Recommended | Sender address, must be a verified domain | [email protected] |
<Callout type={'info'}> Before using Resend, you need to verify your sending domain, otherwise emails can only be sent to your own address. </Callout>
Enable email verification to ensure users own the email addresses they register with (off by default):
| Environment Variable | Type | Description |
|---|---|---|
AUTH_EMAIL_VERIFICATION | Optional | Set to 1 to require email verification after registration |
<Callout type={'info'}> Email verification requires a working email service (SMTP or Resend) configured above. When enabled, users must verify their email address before they can sign in. </Callout>
Enable magic-link login (depends on a working email provider above, off by default):
| Environment Variable | Type | Description |
|---|---|---|
AUTH_ENABLE_MAGIC_LINK | Optional | Set to 1 to enable passwordless magic-link login (off by default) |
<Callout type={'tip'}> Go to Environment Variables for detailed information on all Better Auth variables. </Callout>