Updated 2026-11-20
How to Configure SMTP Email in Vaultwarden
Set these environment variables on the Vaultwarden container: SMTP_HOST=smtp.bulko.io, SMTP_PORT=587, SMTP_SECURITY=starttls, SMTP_FROM with an address on your domain, plus SMTP_USERNAME and SMTP_PASSWORD from your Bulko dashboard. Recreate the container, then open /admin -> SMTP Email Settings and click Send test email.
Vaultwarden has no built-in mail server: until you set SMTP_HOST and SMTP_FROM (or switch on sendmail), it sends nothing at all. That quietly disables a lot of the Bitwarden feature set: email verification on signup (SIGNUPS_VERIFY), organization and emergency access invitations, new device login alerts, the Email two-step login method, password hint emails, email change confirmation and account deletion links.
Most self-hosters run Vaultwarden in Docker on a VPS or a home server, where outbound port 25 is usually blocked and a home IP has no reputation, so pointing it at an authenticated relay on port 587 is the reliable path. Everything below applies to the current Vaultwarden 1.37.x; the SMTP_SECURITY variable has existed since 1.25.0. A short section at the end covers the official self-hosted Bitwarden server, which uses different keys.
Vaultwarden SMTP settings
| Field | Value |
|---|---|
| SMTP_HOST (admin: Host) | smtp.bulko.io |
| SMTP_SECURITY (admin: Secure SMTP) | starttls (port 587 or 2525) or force_tls (port 465) |
| SMTP_PORT (admin: Port) | 587 |
| SMTP_FROM (admin: From Address) | [email protected] (a domain you control) |
| SMTP_FROM_NAME (admin: From Name) | Vaultwarden (default) or your own name |
| SMTP_USERNAME (admin: Username) | Your Bulko SMTP username (smtp_xxxxxxxxxxxxxxxx) |
| SMTP_PASSWORD (admin: Password) | Your Bulko SMTP password |
| SMTP_AUTH_MECHANISM | Leave empty (Plain and Login are tried, Bulko supports both) |
| SMTP_TIMEOUT | 15 (default, seconds) |
| DOMAIN | https://vault.yourdomain.com (needed for links in emails) |
Replace SMTP_SSL and SMTP_EXPLICIT_TLS with SMTP_SECURITY
Older guides and compose files still use SMTP_SSL and SMTP_EXPLICIT_TLS. They were deprecated in 1.25.0 because the names were misleading, and Vaultwarden now prints [DEPRECATED]: `SMTP_SSL` or `SMTP_EXPLICIT_TLS` is set. Please use `SMTP_SECURITY` instead. at startup. They are still converted, and the conversion is where people get caught:
| Old setting | Becomes | Works with Bulko on |
|---|---|---|
SMTP_EXPLICIT_TLS=true | force_tls (implicit TLS) | 465 only |
SMTP_SSL=false | off (no TLS) | nothing, avoid |
| anything else / not set | starttls | 587 or 2525 |
So an old file with SMTP_EXPLICIT_TLS=true and SMTP_PORT=587 tries a TLS handshake on a plain-text port and fails. Delete both old variables and set SMTP_SECURITY explicitly. If you leave SMTP_PORT out, Vaultwarden picks 587 for starttls, 465 for force_tls and 25 for off.
Step-by-step setup
- Buy an SMTP package on the Bulko SMTP Relay page and copy the username and password from Dashboard -> SMTP Access. Optionally verify your domain under Sending domains so mail is DKIM-signed.
- Open your
docker-compose.yml(or the env file /-eflags you start Vaultwarden with) and make sureDOMAINis set to the public HTTPS URL of your vault, otherwise links in invitations and verification emails point to the wrong host. - Add
SMTP_HOST=smtp.bulko.io,SMTP_SECURITY=starttls,SMTP_PORT=587andSMTP_FROMwith an address on your own domain. Optionally setSMTP_FROM_NAME. - Add
SMTP_USERNAMEandSMTP_PASSWORD. Vaultwarden refuses to start if only one of them is set. If the password contains$, write it as$$insidedocker-compose.yml. - Remove any old
SMTP_SSLorSMTP_EXPLICIT_TLSlines (see below), then apply the change withdocker compose up -d. Environment variables are bound to the container, so a plain restart does not pick them up. - Open
https://vault.yourdomain.com/admin, log in with yourADMIN_TOKEN, expand SMTP Email Settings and check that the values arrived. - Enter your address in the Test SMTP field and click Send test email.
- Once the test works, decide whether to turn on
SIGNUPS_VERIFY=true(users must confirm their email) and, if you use email 2FA, let users enable the Email method in their vault.
docker-compose.yml (Vaultwarden with SMTP)
services:
vaultwarden:
image: vaultwarden/server:latest
container_name: vaultwarden
restart: unless-stopped
environment:
DOMAIN: "https://vault.yourdomain.com" # used to build links in emails
SMTP_HOST: "smtp.bulko.io"
SMTP_SECURITY: "starttls" # 587/2525; use "force_tls" with 465
SMTP_PORT: "587"
SMTP_FROM: "[email protected]"
SMTP_FROM_NAME: "Vaultwarden"
SMTP_USERNAME: "smtp_xxxxxxxxxxxxxxxx"
SMTP_PASSWORD: "YOUR_BULKO_SMTP_PASSWORD" # write any $ as $$ in this file
SMTP_TIMEOUT: "15"
# SIGNUPS_VERIFY: "true" # require email verification on signup
volumes:
- ./vw-data/:/data/
ports:
- "127.0.0.1:8080:80"
Admin panel vs. environment variables: config.json wins
You can also type the SMTP values directly into /admin -> SMTP Email Settings and click Save. The first save writes config.json into the data folder (/data in the container), and from then on values in that file take precedence over environment variables. The admin page says so itself: "The settings here override the environment variables."
- If you edited
SMTP_*in compose and nothing changes, check whetherconfig.jsonexists; the startup log lists which settings it overrides. - Pick one place. The Vaultwarden wiki recommends environment variables; use the admin form only if you are fine managing all editable settings there from now on.
- Reset defaults in the admin panel (confirmed by typing
DELETE) removes the saved configuration and restores the defaults and the values set by the environment.
Send a test email
In /admin -> SMTP Email Settings, the Test SMTP row has an address field and a Send test email button. The button only works on saved settings: if you changed any field in the form, Vaultwarden shows "Config has been changed but not yet saved. Please save the changes first before sending a test email." On success you get SMTP Test email sent correctly; on failure Error sending SMTP test email together with the reason, which also appears in the container log (docker logs vaultwarden) as a line from vaultwarden::mail, for example SMTP 5xx error: ... or SMTP timeout error: ....
For a real-world check, invite a user to an organization or change the email address of a test account in the web vault. If you want to see the raw SMTP dialogue, temporarily set SMTP_DEBUG=true. It logs usernames and passwords, so turn it off again right away.
Official self-hosted Bitwarden (bitwarden.sh)
The official Bitwarden server does not use Vaultwarden's variables. Its SMTP settings live in ./bwdata/env/global.override.env, and Bitwarden's own docs say SMTP is required for a self-hosted install: besides user emails, logging in to the System Administrator Portal depends on it.
[email protected]
globalSettings__mail__smtp__host=smtp.bulko.io
globalSettings__mail__smtp__port=587
globalSettings__mail__smtp__ssl=false
globalSettings__mail__smtp__startTls=true
globalSettings__mail__smtp__username=smtp_xxxxxxxxxxxxxxxx
globalSettings__mail__smtp__password=YOUR_BULKO_SMTP_PASSWORD- For port 465 use
ssl=trueand dropstartTls. - Bitwarden documents that
$characters are not supported in SMTP passwords here. - No
trustServerand no files in./bwdata/ca-certificatesare needed: smtp.bulko.io uses a public Let's Encrypt certificate. - Apply with
./bitwarden.sh restart. Restarting single containers does not load the new values. - There is no test button. Check the port from the API container (
docker exec -it <api-container> sh, thenapk add busybox-extrasandtelnet smtp.bulko.io 587), then send an organization invite and read./bwdata/logs/api/if it does not arrive.
Troubleshooting
| Problem | Fix |
|---|---|
| SMTP error: Connection error: ... ssl3_get_record:wrong version number | Encryption mode and port do not match, often because a leftover SMTP_EXPLICIT_TLS=true turned on force_tls for port 587. Use SMTP_SECURITY=starttls with 587 or 2525, and force_tls only with 465. |
| SMTP 5xx error: 535 Authentication failed | Wrong SMTP_USERNAME or SMTP_PASSWORD, or a config.json from the admin panel still holds old values. Paste both again from Dashboard -> SMTP Access and check the $ escaping in compose. More: https://bulko.io/en/smtp-errors/535/. |
| No compatible authentication mechanism was found | Vaultwarden offers Plain/Login only over an encrypted connection, so this appears with SMTP_SECURITY=off or an SMTP_AUTH_MECHANISM Bulko does not support (Xoauth2). Use starttls or force_tls and leave SMTP_AUTH_MECHANISM empty. |
| SMTP timeout error after about 15 seconds | The server cannot reach the port; many VPS and home connections block outbound SMTP. Test from inside the container (see above) and switch to port 2525 with starttls if 587 is closed. |
| Container does not start: Both `SMTP_HOST` and `SMTP_FROM` need to be set | Vaultwarden checks the mail config at startup. Set SMTP_FROM to a valid address together with SMTP_HOST, and set SMTP_USERNAME and SMTP_PASSWORD together. |
| Emails arrive but links point to localhost or are in spam | Set DOMAIN to the public HTTPS URL of the vault. For spam, send from an address on your own domain and verify that domain in Bulko for DKIM; check SPF at https://bulko.io/en/validators/spf-checker/. |
Check that the container can reach smtp.bulko.io
A timeout in Vaultwarden almost always means the network, not the credentials. The Vaultwarden wiki suggests testing from inside the container, because Docker networks and host firewalls can differ from what the host sees:
docker exec -it vaultwarden sh
timeout 5 bash -c 'cat < /dev/null > /dev/tcp/smtp.bulko.io/587'; echo $?
timeout 5 bash -c 'cat < /dev/null > /dev/tcp/smtp.bulko.io/2525'; echo $?0 means the port is reachable. If 587 fails but 2525 returns 0, set SMTP_PORT=2525 and keep SMTP_SECURITY=starttls.
FAQ
Do I need SMTP for Vaultwarden?
It runs without it, but then there is no email verification, no emailed invitations, no new device alerts, no Email 2FA method and no emergency access notifications. Email 2FA cannot be enabled at all without a mail transport.
Why did my SMTP changes in docker-compose have no effect?
Either the container was only restarted instead of recreated with docker compose up -d, or the admin panel has saved a config.json, which overrides environment variables.
What happens if REQUIRE_DEVICE_EMAIL is on and mail fails?
Logins from new devices fail. With REQUIRE_DEVICE_EMAIL=true Vaultwarden must send the new device email, and if sending fails the login attempt fails too, so test SMTP before enabling it.
How much does it cost?
Bulko SMTP is a one-time package: $5 for 5,000 emails, $15 for 20,000, $30 for 50,000 or $60 for 150,000, with no subscription and no expiry. A typical Vaultwarden instance sends only a handful of emails per day.
Is there a sending limit?
Each Bulko SMTP access can send up to 2,000 emails per day, far above what a family or small-team vault generates.
Can Vaultwarden use Gmail or Microsoft 365 instead?
Gmail needs an app password; Microsoft 365 requires OAuth2, which the Vaultwarden wiki says it does not support directly. A relay with a username and password avoids both issues, and you should never put your personal mailbox password into the container.
Get SMTP credentials for Vaultwarden
One-time payment by card or crypto, no subscription. Unused emails never expire. 2,000 emails per day per SMTP account.
What you can send: Acceptable Use Policy.