My system mail is sent with the sender address login@server1 . server1 is the host name ( /etc/hostname ).

I did this in hardcore mode in /etc/exim4/exim4.conf.template in the begin rewrite section with the rule login@server1 login@domain.tld . It works.

How to write a rule:

  • instead of server1 to specify the file /etc/hostname

  • instead of domain.tld to specify a search from the /etc/email-addresses

The server1:domain.tld line will be added to /etc/email-addresses .

  • if you want to organize the substitution of the domain (in the messages passing through you) through the values ​​in /etc/email-addresses , then what does /etc/hostname do with it? - aleksandr barakin

1 answer 1

  1. if you just want to substitute one domain for another in messages passing through your Exim , then /etc/hostname has nothing to do with it.
  2. it is better not to change the already established semantics of the file ( /etc/email-addresses ), but to use another. well, for example, /etc/domain-addresses .

make a substitution in it. eg:

 $ cat /etc/domain-addresses mu:bumbum 

add a substitution rule. something like:

 *@* "${lookup{${domain}}lsearch{/etc/domain-addresses} {$1@$value}fail}" Ffrs 

the third field is flags indicating which headers in which it is necessary to make substitutions.

and check:

 $ /usr/sbin/exim -brw a@mu sender: a@bumbum from: a@bumbum to: a@mu cc: a@mu bcc: a@mu reply-to: a@bumbum env-from: a@bumbum env-to: a@mu 
  • that's right works fine. thank you - LV426