Hello,
I’m having difficulties getting SMTP to work to invite other users to my vault, the rest works fine. I’m using a self-hosted mail server which is also used by my Gitea container with the exact same login information. Neither force_tls over port 465 nor starttls using port 587 work, while both work for the rest of my services.
According to the logs, the login never reaches the mailserver, so I believe that this might be an error where my nginx reverse proxy does not properly forward the POST request to vaultwarden. Since I wasn’t able to solve it myself, any help is greatly appreciated!
Error message using force_tls:
Error sending SMTP test email
SMTP error: Connection error: Connection error: Connection reset by peer (os error 104)
Error message using starttls:
Error sending SMTP test email
SMTP error: response error: incomplete response
Reverse proxy configuration:
(the example by BlackDex)
# The `upstream` directives ensure that you have a http/1.1 connection
# This enables the keepalive option and better performance
#
# Define the server IP and ports here.
upstream vaultwarden-default {
zone vaultwarden-default 64k;
server 127.0.0.1:<myport>;
keepalive 2;
}
# Needed to support websocket connections
# See: https://nginx.org/en/docs/http/websocket.html
# Instead of "close" as stated in the above link we send an empty value.
# Else all keepalive connections will not work.
map $http_upgrade $connection_upgrade {
default upgrade;
'' "";
}
# Redirect HTTP to HTTPS
server {
listen 80;
listen [::]:80;
server_name <my-domain>;
return 301 https://$host$request_uri;
}
server {
# For older versions of nginx appended http2 to the listen line after ssl and remove `http2 on`
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name <my-domain>;
<ssl-cert-configuration-here>
client_max_body_size 525M;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
# If you use Cloudflare proxying, replace $remote_addr with $http_cf_connecting_ip
# See https://developers.cloudflare.com/support/troubleshooting/restoring-visitor-ips/restoring-original-visitor-ips/#nginx-1
# alternatively use ngx_http_realip_module
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location / {
proxy_pass http://vaultwarden-default;
}
SMTP configuration:
Vaultwarden logs:
[2025-10-11 07:35:55.616][vaultwarden::mail][ERROR] SMTP error: response error: incomplete response
[2025-10-11 07:35:55.617][response][INFO] (test_smtp) POST /admin/test/smtp application/json => 400 Bad Request
