---
title: Email setup
description: This guide explains how to configure the secure email verification/password reset. You can configure it to work with various email services, including Gmail and custom mail servers.
---

# Email verification and Password Reset

For a quick overview, refer to the user guide provided here: [Password Reset](/docs/features/password_reset)

## General setup

**Basic Configuration**

If you want to use one of the predefined services, configure only these variables:
For more info about supported email services: https://community.nodemailer.com/2-0-0-beta/setup-smtp/well-known-services/

<OptionTable
  options={[
    ['EMAIL_SERVICE', 'string', 'Email service (e.g., Gmail, Outlook).','EMAIL_SERVICE='],
    ['EMAIL_USERNAME', 'string', 'Username for authentication.','EMAIL_USERNAME='],
    ['EMAIL_PASSWORD', 'string', 'Password for authentication.','EMAIL_PASSWORD='],
    ['EMAIL_FROM_NAME', 'string', 'From name.','EMAIL_FROM_NAME='],
    ['EMAIL_FROM', 'string', 'From email address. Required.','EMAIL_FROM=noreply@librechat.ai'],
  ]}
/>

**Advanced Configuration**

If you want to use a generic SMTP service or need advanced configuration for one of the predefined providers, configure these variables as well:

<OptionTable
  options={[
    ['EMAIL_HOST', 'string', 'Mail server host.','EMAIL_HOST='],
    ['EMAIL_PORT', 'number', 'Mail server port.','EMAIL_PORT=25'],
    ['EMAIL_ENCRYPTION', 'string', 'Encryption method (starttls, tls, etc.).','EMAIL_ENCRYPTION='],
    ['EMAIL_ENCRYPTION_HOSTNAME', 'string', 'Hostname for encryption.','EMAIL_ENCRYPTION_HOSTNAME='],
    ['EMAIL_ALLOW_SELFSIGNED', 'boolean', 'Allow self-signed certificates.','EMAIL_ALLOW_SELFSIGNED='],
  ]}
/>

<Callout type="warning" title="Warning">
**Failing to perform either of the below setups will result in LibreChat using the unsecured password reset! This allows anyone to reset any password on your server immediately, without mail being sent at all!**
</Callout>

## Setup with Gmail

To set up Gmail, follow these steps:

1. Create a Google Account and enable 2-step verification.
2. In the **[Google Account settings](https://myaccount.google.com/)**, click on the "Security" tab and open "2-step verification."
3. Scroll down and open "App passwords." Choose "Mail" for the app and select "Other" for the device, then give it a random name.
4. Click on "Generate" to create a password, and copy the generated password.
5. In the `.env` file, modify the variables as follows:

<OptionTable
  options={[    
    ['EMAIL_SERVICE', 'string', 'gmail', 'EMAIL_SERVICE=gmail'],
    ['EMAIL_USERNAME', 'string', 'your-email', 'EMAIL_USERNAME=your-email'],
    ['EMAIL_PASSWORD', 'string', 'your-email-password', 'EMAIL_PASSWORD=your-email-password'],
    ['EMAIL_FROM', 'string', 'email address for the from field, e.g., noreply@librechat.ai', 'EMAIL_FROM=noreply@librechat.ai'],
    ['EMAIL_FROM_NAME', 'string', 'My LibreChat Server', 'EMAIL_FROM_NAME=LibreChat'],
  ]}
/>

## Setup with custom mail server

To set up a custom mail server, follow these steps:

1. Gather your SMTP login data from your provider. The steps are different for each, but they will usually list values for all variables.
2. In the `.env` file, modify the variables as follows, assuming some sensible example values:

<OptionTable
  options={[    
    ['EMAIL_HOST', 'string', 'Hostname to connect to', 'EMAIL_HOST=mail.example.com'],
    ['EMAIL_PORT', 'integer', 'Port to connect to','EMAIL_PORT=25'],
    ['EMAIL_ENCRYPTION', 'string', 'Encryption type','EMAIL_ENCRYPTION=starttls'],
    ['EMAIL_USERNAME', 'string', 'Your email username','EMAIL_USERNAME=usernale@example.com'],
    ['EMAIL_PASSWORD', 'string', 'Your app password','EMAIL_PASSWORD=password'],
    ['EMAIL_FROM', 'string', 'Email address for the from field','EMAIL_FROM=noreply@librechat.ai'],
    ['EMAIL_FROM_NAME', 'string', 'Name that will appear in the "from" field','EMAIL_FROM_NAME=LibreChat'],
  ]}
/>
