0

I have a Postfix server sending emails for a few different domains. Ideally I'd like to directly send all outgoing messages directly to their MX, as email should work. I have DKIM, SPF and DMARC, I try hard to only send emails (which includes some marketing newsletter) to recipients who are interested in it and immediately honour unsubscription requests. I would like to avoid depending on external mail forwarders as much as possible, but some specific domains still reject my emails from time to time. So I'd like to route some messages through external services, but only for some destination domains, and only for some origin domains (so that I don't have to set up additional SPF and DKIM stuff for domains for which that doesn't make sense in my case).

In other words, I'd like to have an algorithm like this pseudo-Python code:

if origin_domain in ['domain1.com', 'domain2.com'] and destination_domain in ['example1.org', 'example2.org']:
    send_via_transport(external_service)
else:
    default_route()

Is there any way to do that in Postfix? I know there are transport_maps for routing depending on the destination domain and sender_dependent_default_transport_maps for routing depending on the origin domain, but I can't see how to use them to route depending on both.

0

You must log in to answer this question.

Browse other questions tagged .