2

There are two mail domains on two Postfix servers, let's say a.com on server1.com and b.com on server2.com. Users and aliases are stored in an Active Directory, which we access by using the ldap module.

How would I prevent a mail loop in this scenario? Can I forward all mail except if it's coming from one domain?

1 Answer 1

0

If I understand the task well, always_bcc is not your friend.

I would try the transport daemon (transport table) instead.

in transport:

 a.com  smtp:[mail.relay.of.b.com]
 b.com  smtp:[mail.relay.of.a.com]

Of course, we suppose we want to forward to the same user name.


For the updated question: If you want to send copies, you can use the virtual alias transport. virtual_alias_maps = regexp:regexpalias

and in regexpalias do something like this:

 /.+@(a|b).com$/   [email protected],[email protected]

after the usual postmap regexpalias matching mails should go for both destinations. You must be cautious if you have other virtual alias sources defined at the server, because virtual aliasing will be done only once, and exits at the first match. For example if you have:

 virtual_alias_maps = 
          hash:/etc/postfix/myaliases
          regexp:/etc/postfix/regexpalias

And in myaliases you forward [email protected] to [email protected], then your regexp will be never reached and single mail will go to [email protected].

Because you are forwarding the mails directly (transport), and those servers supposedly wont sent the mail back, no more virtual aliasing happens, so there should be no mail loops.

4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .