I'm using Exim v4.91 in a CentOS 7 server hosting more than one domain and I'd like to set up a group address/alias to forward mail messages to all addresses of a given domain (one for every domain). I.e. if I send an email to everyone@example.com it would be sent to *@example.com, all email to everyone@example2.com should be sent to *@example2.com, etc.

I've found how to set up catch-all aliases but what I want to achieve is the opposite, not an alias to receive all incoming messages but a forward-to-all-accounts all incoming messages.


This all depends on whether the source of your domain addresses can be enumerated or not. If the account information is stored in SQL, LDAP or a plain text file then it should be possible. You'd have to set up a redirect router with a data = directive consisting of a string expansion that returns a comma-separated list of accounts. That string expansion might use ${lookup ldapm{<query>}} for LDAP, ${lookup mysql{<query>}} for SQL or ${readfile{<filename>}{,}} for a plain text file. The LDAP and SQL will likely require further processing of the output, for instance replacing the newline record separator by the comma required by the redirect router.

Without knowing where your account information is stored I can't give you any more explicit information, sorry. I don't think the generic linux PAM interface can be enumerated, so if your accounts are just regular linux users then I'm afraid you're out of luck.


A simple way of doing it on a per account basis, if you are using a text config file, e.g.

Add to the top of ROUTERS something like this:

   driver = redirect
   data = ${lookup {$domain} lsearch {/usr/exim/exim.domainalias} {$local_part@$value} }

Where /usr/exim/exim.domainalias contains something like this:

example.net: example.com
example.org: example.com
example.biz: example.com

Each line corresponds to a source domain and a target domain.

You'll sill have to figure out how to expand the account list though, if this is not enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.