juanluisbaptiste / docker-postfix

Simple SMTP relay docker image.
GNU General Public License v3.0
336 stars 166 forks source link

REQ: OVERWRITE_TO #65

Closed unarj closed 3 years ago

unarj commented 3 years ago

similar to the OVERWRITE_FROM option, OVERWRITE_TO would rewrite all TO: fields so that all email passing through goes to a single endpoint. would be useful to me for a home lab environment where several hosts on the LAN are reporting out through a single SMTP relay.

juanluisbaptiste commented 3 years ago

Hi @unarj, why not just run multiple smtp relays, each one poiting to the same destination address ?

unarj commented 3 years ago

I have my firewall block all outbound SMTP ports except from my one mail relay IP for security. besides, running multiple dockers wouldn't alleviate the issue where an email comes in for "root@localhost" and it needs to get to "me@gmail.com" to be seen.

juanluisbaptiste commented 3 years ago

I'm not sure If an application sends an email to root@localhost it will be sent to the smtp relay, as the destination address is localhost, but I have not tested this out.

Also you could configure the aliases of your systems so mail sent to root@localhost is forwarded to the correct address.

unarj commented 3 years ago

yes, I understand how it works. but there's a million TO: possibilities. webmaster@localdomain, postmaster@localhost.localdomain, abuse@publicdomain, etc. I want them all to go to an actual email box so they can be seen and I don't want to make an alias for every possibility. it's really the same principle as the OVERWRITE_FROM option just would overwrite the target instead of the source.

I currently run a non-docker postfix server that uses... recipient_canonical_maps = regexp:/etc/postfix/canonical_recipient ...to get it done. would prefer a docker though so that it's portable.

anyways, if you don't see the value then nevermind.

juanluisbaptiste commented 3 years ago

With OVERWRITE_FROM it makes sense to overwrite all outgoing email with a common address per smtp relay host, but the destination does not. It would make more sense to only overwrite a set of addresses and not all of them.

That implementation is not that simple and only serves your use case, I'm not interested on spending time on this, but PR's are always welcome.

juanluisbaptiste commented 3 years ago

Closing as will not fix.