Hi Melvyn, That makes sense but after reversing the two regexp,

$ postmap -q f...@mydomain.com regexp:/etc/postfix/virtual
b...@myotherdomain.com
(should be b...@somewhere-else.tld)

Which matches the actual rewriting that occurs if a message is sent to
f...@mydomain.com. At least postmap and postfix agree.

This works:
        .:      postfix/virtual
/^foo@/                                 b...@somewhere-else.tld
/^([...@]+)@mydomain.co(m|\.uk)$/               $...@myotherdomain.com

Which amounts to:
        Relay access is permitted for messages sent to addresses
        @mydomain.com or @mydomain.co.uk. Of those that are accepted,
        address rewriting occurs in postfix/virtual. In that regexp
        table, certain addresses are trapped and readdressed to another
        address prefix at myotherdomain.com or somewhere-else.com. Those
        that do not match a specific pattern are re-addressed to the
        same prefix @myotherdomain.com.

In the final catch-all regexp pattern, it is necessary to explicitly
match only those bound for mydomain.com or mydomain.co.uk. If not
explicitly matched, even messages sent to b...@somewhere-else.com are
finally rewritten to b...@myotherdomain.com. This seems like an
inconsistent behavior by postfix. If the catch-all rule is given before
the other, the other rule is never matched. If the catch-all rule is
given last, then both rules match.

Melvyn Sopacua wrote:
> On Friday 22 May 2009 01:10:21 Ken wrote:
> 
>> And, how can I accomplish the catch-all rewrite if this is the expected
> 
>> .:      postfix/virtual
>> /^foo@/         b...@somewhere-else.tld
>> /^([...@]+)@/     $...@myotherdomain.com
> 
> Reverse them. It has the intended effect, but with a different logic:
> "Rewrite all domains and rewrite again for specific usernames".

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to