I'm looking for a way to add headers to all outgoing emails in exim4 (debian 8 setup).
I have tried differents things based on headers_add but i guess my main question is where to put this rule (the config is split in many files in conf.d).
The online documentation of exim isn't so clear to me about that point.
Regards
Best Answer
I've recently had the same challenge, and after much searching didn't find anything. This is my solution which does seem to work, but is specific to my setup, so, check how your exim is actually delivering mail.
We are using a Smarthost (Mailgun) and Exim is configured via the GUI. This can generate the split config files as you have seen. Note you could ask Exim to consolidate the files here, but we're using other software which also modifies the standard Exim config, and so we need the split method.
I then manually edited
/etc/exim4/conf.d/transport/30_exim4-config_remote_smtp_smarthost
, which I believe is the actual transport used when sending outgoing mail via a smarthost. This is what my version looks like now:I added the
headers_add
parameter at line 4 - this is a test server, so I want Mailgun to drop all outbound mail, and this is the way to do it via SMTP.What I'm not 100% certain of is how robust this is to updates and reconfiguration. I'm about to post a related question about that, and will link to this one.