Vaultwarden and Bitwarden SMTP settings for Office 365 and Gmail
Self-hosted Vaultwarden and Bitwarden send email for account verification, two-step login codes, emergency access, organization invitations, and new device alerts. Both sign in to the SMTP server with a username and password, so they can’t send through Microsoft 365 or Gmail, which require OAuth.
With Auth-Email, you change a few environment variables and restart the container.
Before you start: link the mailbox in your Auth-Email dashboard, and choose a password for it. That is the password you’ll enter in Vaultwarden or Bitwarden – not your mailbox password.
The examples below use an Outlook account. Show the server and port for an account provided by Outlook: use outlook.auth-email.com with port 465 wherever the examples show outlook.auth-email.com and 465.
Vaultwarden
Set these environment variables (in your docker-compose.yml, .env file, or docker run command):
SMTP_HOST=outlook.auth-email.com
SMTP_PORT=465
SMTP_SECURITY=force_tls
SMTP_USERNAME=vault@yourdomain.com
SMTP_PASSWORD=your-auth-email-password
SMTP_FROM=vault@yourdomain.com
SMTP_FROM_NAME=Vaultwarden
- SMTPSECURITY=forcetls connects using SSL/TLS straight away, as Auth-Email expects on port 465. (The default, starttls, won’t work on this port)
- SMTP_FROM must be the linked mailbox, or an address that the mailbox is allowed to send as
- Leave SMTPAUTHMECHANISM unset, or set it to Login or Plain – not Xoauth2
Restart the container. To test, sign in to the admin page (/admin), and use Send test email in the SMTP Email Settings section.
Bitwarden (self-hosted)
Edit ./bwdata/env/global.override.env, and set:
globalSettings__mail__replyToEmail=vault@yourdomain.com
globalSettings__mail__smtp__host=outlook.auth-email.com
globalSettings__mail__smtp__port=465
globalSettings__mail__smtp__ssl=true
globalSettings__mail__smtp__username=vault@yourdomain.com
globalSettings__mail__smtp__password=your-auth-email-password
Then apply the changes with ./bitwarden.sh restart. To test, invite a user, or use Forgot password on the login page.
Troubleshooting
- “535 Authentication failed”: check that the username is the full email address, and that the password is the one you chose in Auth-Email (not your mailbox password)
- Timeouts or TLS errors: check that you’re using SSL/TLS on port
465(SMTP_SECURITY=force_tls, orglobalSettings__mail__smtp__ssl=true), and that the container can make outgoing connections on that port - “Sender address rejected” or “SendAsDenied”: the From address must be the linked mailbox, or an address that the mailbox is allowed to send as
For other errors, such as Microsoft 365 reporting that SMTP AUTH is disabled, see fixing common errors. Your account’s connection page in the Auth-Email dashboard also shows whether Vaultwarden or Bitwarden has connected, and explains any error it received. Still stuck? Email us – we’ll help you get it working.
Related articles
Try Auth-Email with your password manager
Link your mailbox, set the SMTP environment variables, and send a test email from the admin page.
Start your free trial →No credit card needed. Check that it works, including sending yourself test messages, before you pay.