mirror of
https://github.com/lobehub/lobehub
synced 2026-04-21 17:47:27 +00:00
* 🔖 chore(release): release version v2.1.34 [skip ci] * 📝 docs: Polish documents * 📝 docs: Fix typo * 📝 docs: Update start * 📝 docs: Fix style * 📝 docs: Update start * 📝 docs: Update layout * 📝 docs: Fix typo * 📝 docs: Fix typo --------- Co-authored-by: lobehubbot <i@lobehub.com>
72 lines
4 KiB
Text
72 lines
4 KiB
Text
---
|
|
title: Email Service Configuration
|
|
description: >-
|
|
Configure LobeHub email service for email verification, password reset, and
|
|
magic link login.
|
|
tags:
|
|
- Email Service
|
|
- SMTP
|
|
- Resend
|
|
- Email Verification
|
|
- Magic Link
|
|
---
|
|
|
|
# Email Service Configuration
|
|
|
|
Email service is used for email verification, password reset, and magic link delivery. LobeHub supports two email service providers.
|
|
|
|
## Nodemailer (SMTP)
|
|
|
|
Send emails via SMTP protocol, suitable for users with existing email services. See [Nodemailer SMTP docs](https://nodemailer.com/smtp/).
|
|
|
|
| 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 | `user@gmail.com` |
|
|
| `SMTP_PASS` | Required | SMTP auth password | `your-app-password` |
|
|
| `SMTP_FROM` | Optional | Sender address (required for AWS SES), defaults to `SMTP_USER` | `noreply@example.com` |
|
|
|
|
<Callout type={'warning'}>
|
|
When using Gmail, you must use an App Password instead of your account password. Generate one at [Google App Passwords](https://myaccount.google.com/apppasswords).
|
|
</Callout>
|
|
|
|
## Resend
|
|
|
|
[Resend](https://resend.com/) 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 | `noreply@your-domain.com` |
|
|
|
|
<Callout type={'info'}>
|
|
Before using Resend, you need to [verify your sending domain](https://resend.com/docs/dashboard/domains/introduction), otherwise emails can only be sent to your own address.
|
|
</Callout>
|
|
|
|
## Email Verification
|
|
|
|
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>
|
|
|
|
## Magic Link (Passwordless) Login
|
|
|
|
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](/docs/self-hosting/environment-variables/auth#better-auth) for detailed information on all Better Auth variables.
|
|
</Callout>
|