I use a server to forward email sent to various domains to the appropriate users' main inboxes. I've got a fairly standard exim installation with the following major change to the configuration:
domainlist local_domains = lsearch;/etc/virtual/domains.list
sender_redirect:
driver = redirect
domains = lsearch;/etc/virtual/domains.list
data = ${lookup{$local_part}lsearch{/etc/virtual/domains/$domain}}
catchall_redirect:
driver = redirect
domains = lsearch;/etc/virtual/domains.list
data = ${lookup{postmaster}lsearch{/etc/virtual/domains/$domain}}
The file /etc/virtual/domains.list
contains a list of all the domains my server handles mail for, and /etc/virtual/domains/
contains files names according to the domain they pertain to, like /etc/virtual/domains/example.com
. Each of those files is formatted like so:
postmaster: me@gmail.com
someuser: address@yahoo.com
otheruser: kittens@aol.com
…and so on. This configuration works as intended. If the user is found in /etc/virtual/domains/example.com
, mail is forwarded to the address given, otherwise it defaults to the "postmaster" address as a catch-all.
I'd like to be able to specify multiple destination addresses so that, for example, mail sent to postmaster@example.com would be forwarded to both me@gmail.com and kittens@aol.com. I tried using a comma-separated list and listing the user twice with different addresses, and in both cases it only forwarded to the first address.
Does lsearch provide a way to do something like this already? If not, is there a way I could modify my configuration to allow it? Any help would be much appreciated.
Best Answer
The process of expanding an alias to a different email address is not limited to a single address. Exim accepts a comma separated list and will route each email address separately. The format that you tried where it was comma-separated should work.