Exim4 with multiple aliases for some internal users?
Posted by ybiC on Mon 10 Apr 2006 at 09:45
I'm configuring a Debian Sarge/Exim4 host to act as an email gateway between the internet and a private LAN email server. The intent is to forward incoming email messages for some users not only to the internal email host, but also back out to their home email addresses.
The Exim FAQ Q0427 shows a technique that looks promising - mulitple aliases files. But in which Exim configuration file should the given block be placed? Fwiw, I'm using the default of "multiple config files" for Exim4.
Or is there a better approach?
cheers,
ybiC
Q0427
Question
How can I have an address looked up in two different alias files, and delivered to all the addresses that are found?
Answer
Use a router like this:
multi_aliases:
driver = redirect
data = ${lookup{$local_part}lsearch{/etc/aliases1}\
{$value${lookup{$local_part}lsearch{/etc/aliases2}{,$value
\
*
{${lookup{$local_part}lsearch{/etc/aliases2}{$value}fail}}}\
}}}
If the first lookup succeeds, the result is its data, followed by the data from the second lookup, if any, separated by a comma. If the first lookup fails, the result is the data from the third lookup (which also looks in the second file), but if this also fails, the entire expansion is forced to fail, thereby causing the router to decline.
Another approach is to use two routers, with the first re-generating the original local part when it succeeds. This won't get processed by the same router again. For example:
multi_aliases1:
driver = redirect
data = ${lookup{$local_part}lsearch{/etc/aliases1}{$value,$local_part}}
multi_aliases2:
data = ${lookup{$local_part}lsearch{/etc/aliases2}}
This scales more easily to three or more alias files.
Managed AntiSpam
Fully managed filtering of your incoming email.
foo: foo@internal, foo@externalThis will create copies to both internal and external mailbox. There is no need for multiple alias files.
[ Parent | Reply to this comment ]
Ah, thanks anonymous. I was looking waaay too hard.
Hmmm... any thoughts on an Exim equivelent to Sendmail's virtusertable, so I wouldn't have to have local accounts on the email gateway?
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]