Q0434 - Exim/exim GitHub Wiki
Q0434
How can I redirect all local parts that are not in my system aliases to
a single address? I tried using an asterisk in the system alias file
with an lsearch*
lookup, but that sent all messages to the default
address.
If your alias file generates addresses in the local domain, they are also processed as a potential aliases. For example, suppose this is your alias file:
caesar: jc
anthony: ma
*: brutus
The local part caesar is aliased to jc, but that address is then reprocessed by the routers. As the address is in the local domain, the alias file is again consulted, and this time the default matches. In fact after the second aliasing, brutus is also processed again from the start, and is aliased to itself. However, this happens only once, because the next time, Exim notices that the aliasing router has already processed brutus, so the router is skipped in order to avoid looping. There are several ways of solving this problem; which one you use depends on your aliasing data.
- If the result of aliasing is always a local user name, that is,
aliasing never generates another alias, you can use the
redirect_router
option on the router to specify that processing the generated addresses must start at the next router. For example:
redirect_router = userforward
assuming that the next router is called userforward. This ensures that there is at most one pass through the aliasing router.
- If you cannot rely on aliases generating non-aliases, it is often easier not to use a default alias, but instead to place a router such as the one below after all the other local routers (for the relevant domains):
catch_unknown:
driver = redirect
domains = ...
data = brutus@$domain
Note that the default aliasing technique works more successfully for virtual domains (see `../Q0401`_) because the generated address for the default is not usually in the same virtual domain as the incoming address.