Q0401

Nigel Metheringham edited this page Nov 30, 2012 · 3 revisions
Clone this wiki locally

Q0401

Question

I need to have any mail for virt.dom.ain that doesn't match one of the aliases in /usr/lib/aliases.virt delivered to a particular address, for example, [postmaster@virt.dom.ain](mailto:postmaster@virt.dom.ain).

Answer

Adding an asterisk to a search type causes Exim to look up * when the normal lookup fails. So if your aliasing router is something like this:

virtual:
  driver = redirect
  domains = virt.dom.ain
  data = ${lookup{$local_part}lsearch{/usr/lib/aliases.virt}}
  no_more

you should change lsearch to lsearch*, and put this in the alias file:

*: postmaster@virt.dom.ain

This solution has the feature that if there are several unknown addresses in the same message, only one copy gets sent to the postmaster, because of Exim's normal de-duplication rules. NOTE: This solution works only if there is also an entry for postmaster in the alias file, ultimately resolving to an address that is not in virt.dom.ain.