Marco Herrn wrote:
> hostedalias:
> driver= redirect
> domains= +hosted_domains
> condition= ${lookup pgsql{\
> SELECT localpart FROM mailalias WHERE \
> domainname='${quote_pgsql:$domain}' AND \
> localpart='${quote_pgsql:$local_part}'}\
> }
This will only work as long as nobody uses no, false or 0 as localpart.
To be fail-safe, add {Yes}{No}. Same in your hosteduser router.
But you don't need condition at all. If the data query result is empty,
the router declines.
> Since it should be possible to have an alias (that forwards to some
> other addresses) and a mailbox with the same name, the 'unseen'
> option is set on the first router. Therefore the second one is
> called, whether or not the first one already matches. That is ok.
I had this problem, too (with a vmail-sql setup). The workaround then
was to create a mailbox with a different name and forward to this
mailbox and the other address. A little cumbersome, but works.
Another (probably better) way is to check in the data query of the
forwarding router if there is a mailbox with the same name and add the
mailbox address in this case, like
hostedalias:
...
data = ${lookup ...alias... {$value ${lookup ... mailbox... {, $value}}}}
ok, looks a little ugly. So you could add the second lookup as condition
to the unseen option itself, like
hostedalias:
...
unseen = ${lookup ...is this also a mailbox?... {yes}{no}}
Personally I don't like the unseen option much, but it may be better in
your case.