david wrote:
> To accomplish this, I set values in /etc/postfix/main.cf:
> 
> mydomain      = d1.tld
> mydestination = localhost.$mydomain localhost $mydomain
> virtual_alias_domains = d2.tld
> virtual_alias_maps = hash:/etc/postfix/virtualusers
> 
> The file /etc/aliases contains:
> root: owner_d1
> 
> and the file /etc/postfix/virtualusers contains:
> 
> [email protected]   d1_a
> [email protected]   d1_b
> @d1.tld       owner_d1
> @d2.tld       owner_d2

I don't see anything wrong as such with the above.  Seems like it
should work.  And for me I have a very similar arrangement here.  So I
modified it so that I could test the above case here.  It worked for
me here.

Therefore I suspect that the problem is something insidiously and
subtly different from exactly what is shown and what you think you
have there.  Which means I would suggest going back and double
checking *everything* and seeing what might be different.

> And my problem is that all mail for anyone d1.tld and d2.tld gets delivered
> to owner_d1.

I set up the same case as the above here and it worked for me.

> Can anyone advise me where to look for a solution?

What do the logs say in such a case for you?  For me I see the
following when I set up the test case.  I might like to redact some
extraneous things that are not important but I will avoid that and
show the line verbatim.

    Feb  2 18:22:54 havoc postfix/smtp[29102]: 84E5349D: 
to=<[email protected]>, orig_to=<[email protected]>, 
relay=127.0.0.1[127.0.0.1]:2501, delay=0.7, delays=0.25/0.03/0.25/0.17, 
dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as E3DC321152)

I sent a test message to [email protected] which correctly mapped
through the virtual map table to [email protected].  And then it
was delivered through a tunnel as specified elsewhere accounting for
the 127.0.0.1 localhost relay.

    rwp@havoc:~$ postmap -q @ncic.net /etc/postfix/virtual
    [email protected]

Try checking everything all over again.  Try verifying that your
mapping is being correctly mapped using the query functionality of the
postmap command.

Expected results for you given your above:

    $ postmap -q [email protected] /etc/postfix/virtualusers
    d1_a

    $ postmap -q [email protected] /etc/postfix/virtualusers
    d1_b

    $ postmap -q @d1.tld /etc/postfix/virtualusers
    owner_d1

    $ postmap -q @d2.tld /etc/postfix/virtualusers
    owner_d2

Send a test message through and look at the log entry as I did above
and verify that the orig_to= records your incoming test address and
that the to= records the outgoing virtual map address.

I assume there is no smtp_generic_maps active that would interfere as
I believe that mapping would happen after virtual mapping.  Don't
quote me on that but I could see generic mapping causing confusion in
this path.

Hopefully you will get something different along the way and that will
provide a clue.  Good luck!

Bob

Reply via email to