Hello,

I try to configure my server as a mail relay for all domains, I go through the internal lan then logically forward to the outside.
I get a “relay access denied” when I entered the lan in the “forwarding hosts”.
I can’t figure out why I’m getting this result.
The firewall is open in both directions though.
I specify that I do not host any domain on the server.
Could you guide me please?
Thanks 🙂

5 days later

I don’t thanks nobody to help me.
Mutual aid is important these days and I hope that one day for whatever reason you will need help and we will leave you like you did with me, namely to rot.
I wasn’t asking for my problem to be solved, just for a referral.
What is a community for if it isn’t for that.

Have something to say?

Join the community by quickly registering to participate in this discussion. We'd like to see you joining our great moo-community!

Hello, fdnoich,
I ran into the same trap. For me this reads like a bug. Anyway.
In the end I was able to solve it by adding the LAN or at least some hosts as “mynetworks =” in data/conf/postfix/extra.cf
Please bear in mind a single host needs to be entered as 192.168.1.1/32 in CIDR notation.

I hope this helps.

This is not a bug and by design, and also the default behavior by postfix. Sending emails through mailcow requires legitimate authentication with SMTP to send emails.

In earlier days all internal networks were allowed to send unrestricted emails through mailcow. This being a security concern in less secure, misconfigured or infected environments, this was re-considered. In some cases users caused with wrong network configuration (NAT) to have their mailcow installations being a open-relay abused for sending spam and getting their IP blacklisted.

Please see following documentation:
https://mailcow.github.io/mailcow-dockerized-docs/manual-guides/Postfix/u_e-postfix-trust_networks/

Also see in the default postfix configuration:
GitHub Icon mailcow-dockerized/data/conf/postfix/main.cf at 91906a711f7f8c4be93bdbde8f6e9d423485a54a · mailcow/mailcow-dockerized

Here’s documentation what postfix considers as mynetworks:
Postfix Configuration Parameters

Dear pkernstock,
you probably got me wrong. I’m aware of the aspect you are describing, but this is not my issue.
More likely my subject was misleading.

My problem is: mailcow needs to use a smarthost to deliver mails to the Internet !
And in order to keep comunication between my internal domains (same LAN segment) I need to setup a routing like:
If destination is dom1 (on mailcow), then deliver to mailbox.
If destination is dom2 - dom5, then relay to Exchange using transport map.
If destination is Internet, then deliver to smarthost at my provider’s site.

So I need to know 2 things:
#1 How to setup mailcow, so all outbound mail is delivered to my provider’s smarthost?
#2 How to configure mailcow, so the routing above works?

Cancel my last, I got confused with the two threads.

I have a similar configuration like your #1 with no problem. I configured that under
Configuration & Details -> Routing -> Sender-dependent transports

There I configured my relay server and under Configuration -> Mail Setup -> mydomain, I used that entry as a Sender-dependent transport

( See Documentation mailcow.github.io Icon here

)

Concerning your #2 Problem, I think that should be able to solve that with global Transport Maps. (Configurable right under Sender-dependent transports)

Dear MrBubbles,
we are discussing this in the wrong thread. please switch over to mailcow community Icon Routing of multiple domains

.
To respond to our ideas:
I tried your approach already, but I ended up Mailcow bouncing mails for “mydomain” between smarthost and itself.
Or in other words: I expected mailcow to route mails for “mydomain” to the related mailboxes on the mailcow, but instead it started bouncng. This is what confused me.

3 months later

Thanks all to answer to me.
have a nice day

a year later

OK, but what to do if I have an enterprise antispam server between mailcow and Internet? In clean postfix, I set up the relayhost parameter and that’s all. All e-mails from every domain I support are sending via antispam appliance, and I don’t need to configure domains separately to achieve that behavior. How can I do the same in mailcow?

No one is typing