> On Tue, Mar 22, 2022 at 08:38:39AM +0100, Arrigo Triulzi wrote: >> I was hoping to be able to use a transport re-write but if I set it up it is >> ignored because of the virtual domain settings. > > Please show real configs.
Yes, I apologise, I should have done this. Please also excuse the late reply. >> Does anyone have any recommendations on how to go about with this? > > Well. > > main.cf: > parent_domain_matches_subdomains = > > relay_domains: > example.com exists > > relay_rcipient_maps: > b...@example.com exists > f...@example.com exists > > transport_maps: > example.com smtp:exchange > list.example.com smtp:list > > virtual_alias_maps: > l...@example.com l...@list.example.com > > This ought to work. I can see how this would work but it would mean having a list of all the valid recipients in relay_recipient_maps which I can’t (trivially) have… what I had tried so far was: - main.cf: virtual_alias_domains = hash:/etc/postfix/virtual_domains virtual_alias_maps = hash:/etc/postfix/virtual - virtual_domains: example.cloud - virtual: hostmaster@example.cloud hostmas...@ops.example.com postmaster@example.cloud postmas...@ops.example.com abuse@example.cloud ab...@ops.example.com noc@example.cloud n...@ops.example.com security@example.cloud secur...@ops.example.com root@example.cloud r...@ops.example.com @example.cloud @example-cloud.mail.protection.outlook.com Which, according to a bit of Exchange documentation, should have worked because @example-cloud.mail… is mapped to @exmaple.cloud. This is actually not true, you need to have another domain defined as, for example, @exampledev.onmicrosoft.com. So, change that to read: - virtual: hostmaster@example.cloud hostmas...@ops.example.com postmaster@example.cloud postmas...@ops.example.com abuse@example.cloud ab...@ops.example.com noc@example.cloud n...@ops.example.com security@example.cloud secur...@ops.example.com root@example.cloud r...@ops.example.com @example.cloud @exampledev.onmicrosoft.com This now delivers everything just fine but it turns out that if you have both users and aliases on Exchange then the users are delivered but aliases fail as they are expected to be set to alias@example.cloud and the other domain is only valid for “real” users. At which point I thought I’d use transport so I added transport_maps = hash:/etc/postfix/transport - transport: example.cloud smtp:[example-cloud.mail.protection.outlook.com] And removed the `@example.cloud` catch-all from virtual above. The (wrong) logic was that in the absence of a virtual map this would fall-through to the transport and be relayed correctly. In retrospect it is obvious it won’t work because the virtual_ stuff takes care of the whole virtual domain and expects all the details. virtual_transport does not do the trick either, of course, because the whole virtual_ stuff assumes that we are doing either re-writing or local delivery. I am therefore a little bit stuck. Cheers, Arrigo