[exim] executing a router only, when no other router was acc…

Top Page
Delete this message
Reply to this message
Author: Marco Herrn
Date:  
To: Exim-users
CC: 
Subject: [exim] executing a router only, when no other router was accesses
Hi,

the following is a part of my exim router configuration:

----------

hostedalias:
  driver= redirect
  domains= +hosted_domains
  condition= ${lookup pgsql{\
                SELECT localpart FROM mailalias WHERE \
                domainname='${quote_pgsql:$domain}' AND \
                localpart='${quote_pgsql:$local_part}'}\
              }
  data= ${lookup pgsql{\
           SELECT forward_to FROM mailalias WHERE \
           domainname='${quote_pgsql:$domain}' AND \
           localpart='${quote_pgsql:$local_part}'}\
        }
  hide_child_in_errmsg
  unseen



hosteduser:
  driver= accept
  domains= +hosted_domains
  condition= ${lookup pgsql{\
                SELECT localpart FROM mailbox WHERE \
                domainname='${quote_pgsql:$domain}' AND \
                localpart='${quote_pgsql:$local_part}'}\
              }
  transport= hosted_delivery
  cannot_route_message= Unknown mailbox



hostedcatchall:
  driver= redirect
  domains= +hosted_domains
  condition=     ${lookup pgsql{\
                        SELECT localpart FROM mailalias \
                        WHERE localpart='${quote_pgsql:*}' \
                        AND domainname='${quote_pgsql:$domain}' \
                    }\
                  }
  data= ${lookup pgsql{\
           SELECT forward_to FROM mailalias WHERE \
           domainname='${quote_pgsql:$domain}' AND \
           localpart='${quote_pgsql:*}'}\
        }
  hide_child_in_errmsg


--------------

The first one handles aliases (not the system aliases, since I use virtual users).
The second one handles real mailboxes.
The third one is run when there is a catchall defined for the domain.

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.

The problem is, the third router should only be run when no other router matches. But since the first one has the 'unseen' option, it is run again.

Is there a way to find out, whether any other router already matched and set this as a condition to the third router?

Regards
Marco