Relay delivery rules based on sender email

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Relay delivery rules based on sender email

will_mike
This post was updated on .
Can you please explain how to define delivery rules to relay messages to two different  mail servers based on senders email format.

relay rules to be configured:

rule1
anything going to *@mycompany.org relay to:  mycompany.mail.protection.outlook.com:25

rule2
anything coming from *@notifications.mycompany.org relay to smtp.domain2.com:587

rule3
not from from *@mycompany.org, or *@notifications.company.org, going to external recipients relay to mycompany.mail.protection.outlook.com:25

Thanks,

Michael
Reply | Threaded
Open this post in threaded view
|

Re: Relay delivery rules based on sender email

Viktor Dukhovni
On Wed, Sep 16, 2020 at 02:56:47AM +0000, MichaelV wrote:

> Can you please explain who to define delivery rules to relay messages
> to two different  mail servers based on senders email format.
>
> relay rules to be configured:
>
> rule1
> anything going to *@mycompany.org relay to:  mycompany.mail.protection.outlook.com:25
>
> rule2
> anything coming from *@notifications.mycompany.org relay to smtp.domain2.com:587
>
> rule3
> not from from *@mycompany.org, or *@notifications.company.org, going to external recipients relay to mycompany.mail.protection.outlook.com:25

This can be accomplished with sender_dependent_default_transport_maps:

    1.  main.cf:
            indexed = ${default_database_type}:${config_directory}/
            transport_maps = ${indexed}transport

        transport:
            mycompany.org smtp:mycompany.mail.protection.outlook.com

    2.  main.cf:
            sender_dependent_default_transport_maps = ${indexed}sender-transport

        sender-transport:
            notifications.mycompany.org smtp:smtp.domain2.com:587

    3.  main.cf:
            default_transport = smtp:mycompany.mail.protection.outlook.com

Good luck.

--
    Viktor.