Looking for a trivial mail relay in docker reddit / selfhosted ---------------------------------------------------------------------- kalsan15 · 2023-12-12 15:44 Hi! When I've started my research into this several hours earlier, I was under the impression that what I'm looking for is straightforward, trivial and an absolute mainstream use case. Hours of pointless research have made me doubt that, or, perhaps even more true, my very own sanity. This is what I'd need: Given a set of machines that are part of the same LAN, I want to spawn a docker container providing an SMTP relay without credentials, only available within that LAN. When a machine in the LAN needs to send a mail (e.g. a failing cronjob etc.), that relay accepts the message and forwards it to an actual mail server (e.g. gmail) in the internet, providing credentials. This way, the cronjob does not have to store and credentials and neither does that host. SMTP credentials for the true mail server are only stored in the relay, and if those are to change, I only need to update the config of a single machine. Also, since it's only in an isolated LAN, I'm not worried about abuse of the relay. What I've looked at so far: * Postfix with SASL but it's insanely complex, there's no docker image available and I need to update it by rebuilding the image. Also, it's completely overkill. * ssmtp or msmtp, but again, there's no docker image available * Tons of tinker projects such as [https://hub.docker.com/r/philoles/s smtp](https://hub.docker.com/r/philoles/ssmtp) which claim to provide exactly what I need (the given example is especially tempting as a .env file should do the trick), but most of them are unmaintained, undocumented, or both. * Gists, Medium articles and tutorials of questionnable quality, fixing and patching things with ducktape and using outdated software. I can't believe there's not a single mainstream docker image out there doing that simple relay magic without the need of compiling, building, reconfiguring, patching or otherwise doing dirty business. I can't be the only one facing this, and all config could be done through ENV variables like so many other docker images do. I conclude that my research must have been poor and that I've most likely wasted time searching the wrong thing. So please consider this to by my public cry for help in this surprisingly hairy topic. What are the proper terms for what I'm looking for? What are popular options to solve this? ---------------------------------------------------------------------- thekrautboy · 2023-12-12 15:49 msmtpd by crazy-max ---------------------------------------------------------------------- ripnetuk · 2023-12-12 17:54 I use image: namshi/smtp It works well relaying via Gmail for me ---------------------------------------------------------------------- CatoDomine · 2023-12-12 19:31 I did this manually with exim on debian, but anything running an SMTP server should be able to relay through a "smarthost" ---------------------------------------------------------------------- adamshand · 2023-12-12 20:59 ``` ❯ cat docker-compose.yml --- version: "3" services: postfix: image: juanluisbaptiste/postfix:latest container_name: postfix restart: unless-stopped ports: - "25:25" volumes: - /etc/localtime:/etc/localtime:ro env_file: - .env environment: - DEBUG=no - SERVER_HOSTNAME=nikau.example.nz ❯ cat .env SMTP_SERVER=smtp.gmail.com SMTP_PORT=587 SMTP_USERNAME=adamshand SMTP_PASSWORD=lakdsjfalskdfja ``` ---------------------------------------------------------------------- HoustonBOFH · 2023-12-12 21:12 I do not have an answer for you, but wanted to compliment you on an amazingly good question! You stated what you needed clearly. You mentioned what you tried and why it did not meet your needs. You even talked about how you looked! I need to keep this an an example of a good questions as opposed to "My stuf no work HeLpMe!" ---------------------------------------------------------------------- jakesomething · 2023-12-12 22:31 Check out mailhog ---------------------------------------------------------------------- degan6 · 2023-12-13 05:44 [Mailrise](https://github.com/YoRyan/mailrise) was made to solve this problem. I only recently found it, ---------------------------------------------------------------------- kalsan15 · 2023-12-13 15:51 >juanluisbaptiste/postfix Damn. 2 minutes in and I got a mail by myself. I guess crazy max is the end of my mad fury road. Thanks a bunch!