mirror of
https://github.com/stoatchat/self-hosted.git
synced 2026-07-21 04:25:24 -04:00
bug: Revolt docker container cannot talk to postfix smtp server at localhost:25 #44
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @alexispurslane on GitHub (Apr 22, 2023).
What happened?
In order to allow Revolt to send emails, I set up a postfix server for outgoing emails on the same server the Revolt docker container is running on, listening on the standard port 25. There's no username and password, so no authentication to speak of, and I've opened that port on the firewall. I can connect to it and send emails from both my local computer and on the same server outside the docker container, and I've added the docker0 address to the list of networks the postfix accepts, so it should work, but when I try to turn emails on, I just get this:
over and over.
@alexispurslane commented on GitHub (Apr 22, 2023):
I went and checked the code, and the problem seems to be due to the fact that quark panics if all of the SMTP variables are not set and the
UNSAFE_NO_EMAILflag is not set, even if some of those SMTP variables (the password, in this case) aren't relevant.@alexispurslane commented on GitHub (Apr 22, 2023):
I could move this to the backend repo
@alexispurslane commented on GitHub (Apr 22, 2023):
If I set the password to an empty string, it doesn't crash, and can attempt to send emails, but it doesn't appear to succeed in sending them:
@alexispurslane commented on GitHub (Apr 22, 2023):
Apparently, this is due to a service running in a docker container not being able to recognize
localhost. SwitchingSMTP_HOSTtohost.docker.internalor my server's IP address (behind the router) changes the error to:@alexispurslane commented on GitHub (Apr 22, 2023):
I don't know how to resolve this error, but it doesn't seem to step from Revolt.
@alexispurslane commented on GitHub (Apr 22, 2023):
Okay, so I resolved all the explicit errors, so Revolt SAYS that it was successful in sending the email, but nothing ever happens. What assumptions does it make about the setup of the SMTP server that might be causing this?
@fungalcofe commented on GitHub (Jun 15, 2023):
host.docker.internalis only for Docker Desktop (macOS and Windows).There’s no easy nor fancy way to join host, but using its main IP.
What you could do is running that Postfix in a container too and having a network for both backend and Postfix.
@dollhaus commented on GitHub (Jul 17, 2024):
@alexispurslane I spent a few days troubleshooting this very recently, if you didn't get your setup working you may be interested.
Docker usually assigns the IP 172.17.0.1 to its host network. You can check this for yourself by telnetting from the container (using docker exec -it /bin/bash) to the host. You can use this as the hostname, assuming that postfix and dovecot run on the same machine.
Note: You'll need to also see the revised approach to configuring Revolt, as well as implementing the extra parameters that I noted here: #89
@insertish commented on GitHub (Jul 28, 2024):
Since this issue seems unrelated to Revolt, I'm going to close it out.
I did find https://stackoverflow.com/a/48547074, probably relevant.