On 2012-06-17 Chris Richards wrote:
> I'm sure this can't be the first time this has come up, but my
> google-foo just isn't strong enough to find what I'm looking for.
> Here's the scenario:
> 
> Postfix is final destination for domain1.tld, and is implemented as
> virtual mailboxes (no local unix accounts), with mysql lookups.  So
> far so good, and that's easy to setup.  u...@domain1.tld either gets
> delivered to the local mailbox, or rejected.
> 
> Now the wrinkle: if u...@domain1.tld doesn't exist, RELAY to
> u...@domain2.tld (same user in a different domain).  domain2.tld
> exists on another server and the databases are NOT shared.
> 
> I've setup an entry in virtual-alias-domains so that @domain1.tld
> returns @domain2.tld.

$virtual_alias_domains is a list of virtual domains your server accepts
mail for. It doesn't take any input nor does it return any output. I
suppose you mean $virtual_alias_maps.

> It's my understanding that should cause u...@domain1.tld to be mapped
> to u...@domain2.tld according to the virtaul(5) readme.  That didn't
> seem to be working, so I thought "well maybe it's because I'm not a
> delay for domain2.tld", so I setup a relay-domains entry that says I'm
> a relay for domain2.tld (again, all of this is driven by a mysql
> database).

Virtual domains are domains that your server is the final destination
for. Relay domains are domains that your server is NOT the final
destination for. Do not confuse the two.

Since your mail server is only responsible for domain1.tld, not for
domain2.tld, the latter belongs in $relay_domains. Use either

- $relay_recipient_maps (if you can obtain a list of valid recipients of
  domain2.tld)
- LDAP lookups (if you have access to an LDAP server listing the valid
  recipients of domain2.tld)
- reject_unverified_recipient [1]

to avoid bounces.

> Whenever I send mail to u...@domain1.tld (where a mailbox actually
> exists), the mail gets delivered exactly like I'd expact.  Whenever I
> send mail to us...@domain2.tld, it bounces with:
> 
> 'Recipient address rejected: User unknown in virtual mailbox table'

Who bounces the message? Your server, or the upstream server? If it's
your server generating the bounce, then your server apparently considers
domain2.tld to be one of its virtual MAILBOX domains (which is something
entirely different from virtual ALIAS domains).

Please post the output of "postconf -n" (as requested per the list's
welcome message), and the relevant content of $virtual_alias_domains,
$virtual_alias_maps, $virtual_mailbox_domains, $virtual_mailbox_maps,
and $relay_domains.

> Is what I'm attempting to do even possible?  Also, I really don't want
> to become a backscatter source.  Can I turn on address probes for this
> one domain, or is it pretty much on for everyone?

By putting a wildcard mapping (@domain1.tld @domain2.tld) into your
$virtual_alias_maps, you do become a backscatter source, because virtual
aliases are not resolved recursively. A left-hand value of @domain1.tld
means "accept all mail to domain1.tld and send it to whatever is the
right-hand value".

Dynamic routing like "if us...@domain1.tld doesn't exist, then forward
the mail to us...@domain2.tld" is not possible in Postfix (at least not
that I'm aware of).

[1] http://www.postfix.org/postconf.5.html#reject_unverified_recipient

Regards
Ansgar Wiechers
-- 
"Abstractions save us time working, but they don't save us time learning."
--Joel Spolsky

Reply via email to