We use Exim on our servers to send emails only from local automated users, as root, cron, etc.
We have to specify every possible users into /etc/email-addresses
. For example:
root: alert@example.com
cron: alert@example.com
backup: alert@example.com`
This allow us to receive every email generated.
The problem is when we add a user for whatever reason (for example when we add a package, some add a user), we can forget to add this user to /etc/email-addresses
. Most of the time it's not a problem, but this is not clean. And the overall method is not clean.
We'd like to configure Exim to send every emails with the same source address. i.e. every sent email comes from alert@example.com
One way could be to use a wildcard or a regular expression into /etc/email-addresses
but this is not supported.
I don't currently understand Exim enought to figure out how to modify this in a way or another.
Ideally, Exim should look into /etc/email-addresses
first, and if no match it use the predefined address. But this is very secondary.
There are two places where this address is used:
1. when Exim send the FROM:
command to the smtp server
2. inside the header
edit:
The rewrite section is the original one from Debian
begin rewrite
.ifndef NO_EAA_REWRITE_REWRITE
*@+local_domains "${lookup{${local_part}}lsearch{/etc/email-addresses} \
{$value}fail}" Ffrs
*@ETC_MAILNAME "${lookup{${local_part}}lsearch{/etc/email-addresses} \
{$value}fail}" Ffrs
.endif