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

$ postmap -q [email protected] regexp:/etc/postfix/virtual
[email protected]
(should be [email protected])

Which matches the actual rewriting that occurs if a message is sent to
[email protected]. At least postmap and postfix agree.

This works:
        .:      postfix/virtual
/^foo@/                                 [email protected]
/^([...@]+)@mydomain.co(m|\.uk)$/               [email protected]

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 [email protected] are
finally rewritten to [email protected]. 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@/         [email protected]
>> /^([...@]+)@/     [email protected]
> 
> 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