How to set up system email on self hosted instance?

I’m a newbie to setting up self-hosted services, sorry if I sound like I don’t know what I’m talking about.

I have BitWarden up and running, but I need to add email details to my environment in order verify my accounts, and it seems like it would be a good idea generally to have it set up.

I pay for ProtonMail premium as my primary email account. By default, ProtonMail does not use SMTP because it is encrypted. Is there any way I can use ProtonMail for this? There is a bridge service you can use to run an SMTP server, but I’m not sure if this would work.

Assuming it would, what address would the system emails be sent from? I have several aliases and I would like to use my “admin” address instead of my “name” address if that makes sense.

I do have a GMail account, but I’m moving to self hosted and stuff as a part of an effort to move away from Google and related services, so I don’t really want to do that.

If I can’t use ProtonMail, is there some other email service I can use?

EDIT:

I went ahead and tried using the bridge. I set it up and I got the port from the application, and I set the host to 127.0.0.1, since the bridge is running on the same server as BitWarden.

When I try to send the verification email, I get a notification that says “An unhandled server error has occurred”. How can I access the logs to see what is going on?

1 Like

Having the same problem, anyone know how to get this working?

I still haven’t been able to find any useful logs, so I’m not sure, but I suspect that the server is not able to see the bridge running on my local machine. 127.0.0.1 is likely getting routed into the container, not the host, so it doesn’t see the bridge. You could probably fix this by passing the port from the host to the container, but I don’t really want to mess with the bitwarden script, so unless I want to expose my bridge to the Internet, I don’t think I’m going to be able to use ProtonMail.

Which is just as well, I probably don’t really want to be doing that. This is just for my family, but I still don’t want to route automated emails through my personal account. I also think ProtonMail might not really like me doing that.

The solution I’m leaning towards now is Mailgun, which is actually suggested by the bitwarden documentation.

They have a free trial you can use without a credit card and it worked just fine with my bitwarden install. And the pricing is really tolerable, only $0.80 for 1000 emails per month. For my purposes that’s luxurious.

You can still send the automated messages from your custom domain. As long as you don’t edit your MX record, normal email receipt through ProtonMail shouldn’t be affected.

I have some other stuff that I will be self-hosting in the future, so this seems like the best long term bet.

Just found this post about 13 months late but protonmail bridge on same docker host as bitwarden does indeed work. Here is what got it working for me on 1.45.2

globalSettings__mail__replyToEmail=whatever-email-address
globalSettings__mail__smtp__host=ip-address-of-bridge/bitwarden-docker-host
globalSettings__mail__smtp__port=your-external-port-on-docker-host-for-protonmail-bridge
globalSettings__mail__smtp__ssl=false
globalSettings__mail__smtp__username=email-address
globalSettings__mail__smtp__password=bridge-passwd-for-the-account-above
globalSettings__disableUserRegistration=false
globalSettings__hibpApiKey=REPLACE
adminSettings__admins=admin-email-if-wanted-can-also-be-bridge
globalSettings__mail__smtp__startTls=false
globalSettings__mail__smtp__trustServer=true

This may or may not be best practices security wise however mine in on local lan which can only be accessed by vpn from the outside world, all is working well for me! Hope this saves somebody several hours over several days. Cheers!

2 Likes