Exim: send every emails with a predefined sender

Posted by Gregory MOUSSAT on Server Fault See other posts from Server Fault or by Gregory MOUSSAT
Published on 2012-04-09T13:17:15Z Indexed on 2012/04/09 23:34 UTC
Read the original article Hit count: 292

Filed under:

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: [email protected]
cron: [email protected]
backup: [email protected]

This allow us te 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 [email protected]

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

(comments removed)

© Server Fault or respective owner

Related posts about exim