Spit Balling A Work Around For Blocked Email Port
from irmadlad@lemmy.world to selfhosted@lemmy.world on 13 Apr 17:18
https://lemmy.world/post/28177251

I have a couple Docker containers that use email as an alert system or just for info like completed jobs. The server I would like to host them on has, for whatever reason, blocked email ports and you have to pay extra to have them turned on.

It seems to me tho, that I should be able to port all email through Tailscale to a local or even remote email client. For instance, in the case of setting the parameters in the Docker compose, it would look something like this:

SITE_NAME: mycoolwebsite
DEFAULT_FROM_EMAIL: email address
EMAIL_HOST: smtp
EMAIL_HOST_USER: email address
EMAIL_HOST_PASSWORD: email password
EMAIL_PORT: 100.x.x.x:587

Then, configure the local email client to listen on 100.x.x.x:587.

Would this be doable, or is there a better way?

#selfhosted

threaded - newest

2xsaiko@discuss.tchncs.de on 13 Apr 17:40 next collapse

Yeah, this should work (assuming by email client you mean MTA).

Alternatively, you can set up Postfix to deliver mail over SSH to another MTA by defining a new service in master.cf that calls sendmail on the destination server. This postfix could run in a container as well or on the host, whatever is reachable.

Old NixOS configuration for that here, see the default_transport and masterConfig parts: git.dblsaiko.net/systems/tree/…/relay.nix?h=ssh-m…

Alternatively, if you don’t have another mail server somewhere that you want to relay to, the simplest option is probably to just have Postfix deliver into a local mailbox and access that over IMAP (the imaps port should not be blocked, right? You can use a non-standard port though). Turn off non-local delivery though.

irmadlad@lemmy.world on 14 Apr 02:45 collapse

the simplest option is probably to just have Postfix deliver into a local mailbox and access that over IMAP

I already have sendmail on the server. Is there something special about Postfix? Just asking,I’ve never run Postfix and I’ve never had this experience before with a host. I guess they think that if they charge an extra 6 Euros to flip the switch, people wouldn’t use it for spam purposes. I’m bound and determined to figure out a workaround just because.

2xsaiko@discuss.tchncs.de on 14 Apr 09:51 collapse

There isn’t really, you can probably use sendmail as well. Postfix is just the MTA I’m used to and know can do all of this.

From what I’ve heard about sendmail’s config file, I personally wouldn’t want to use it specifically though…

pgo_lemmy@feddit.it on 13 Apr 21:43 next collapse

You need a mail server somewhere, a mail client cannot listen for incoming messages. A possible workaround: you could activate your own mail server accessible only inside tailscale and use it to send and receive your local alerts.

irmadlad@lemmy.world on 14 Apr 02:34 collapse

Would something like Mailu work. It runs in a docker container.

ETA: The client would be on my desktop in the form of Thunderbird. It lives on part of my tailnet. In theory, it would be ‘connected’, no?

pgo_lemmy@feddit.it on 14 Apr 05:36 collapse

Mailu is a mail server so it is suitable for the task.

sugar_in_your_tea@sh.itjust.works on 13 Apr 21:47 collapse

If you control both sides, you can just use a non-standard port. If you only control the client, you just need to make sure wherever your data exits allows outgoing traffic on that port.

So yeah, that should work.