V
V
vis0r2018-04-07 12:44:24
Debian
vis0r, 2018-04-07 12:44:24

How to configure exim4 to send mail from a site?

Briefly in order. There is one web server...
It is made so that php scripts of each site are executed from different users. That is, one site - one user in the system.
For example, there is a user site1. And let's say a script is executed from this site with sending a letter through the built-in mail () function (which calls sendmail, which is actually a symlink to exim4).
When this letter reaches the addressee, the local user of the server who sent it (site1) is scorched in its headers. In fact, this is the login of the user in the system from under which the script was launched to send this letter and the local hostname of the machine itself.
6rHTaQ5lKAE.jpg
So I would like to know how to change this sending address ([email protected]) to any other email address (within the domains hanging on this IP)?
For example, so that each site sends a letter from under its own domain. For example [email protected]
UPDATE 1
Found the /etc/email-addresses file where you can specify outgoing mail for each local user.
For example, in my case, adding the following line there:

# user: email
site1: [email protected]

will change the headers of the letter (changes are circled in red), which already brings me a little closer to my goal - to remove the local username of the sender and the hostname of the server from the headers:
kA6BDeCjSSg.jpg
However, there are 2 places where the hostname and user are still burning:
lOah5r5DFR4.jpg
Now the main question is how to remove them altogether, or if this is not possible, then change to the same [email protected] ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vis0r, 2018-04-07
@vis0r

The task was solved by editing and bringing the default header Received to normal:
We remove the local user name and Exim version from there.
To do this, you need to insert into the config /etc/exim4/exim4.conf.template right before the begin acl section:

received_header_text = Received: \
  by $primary_hostname \
  ${if def:received_protocol {with $received_protocol}} \
  ${if def:sender_address \
  {(envelope-from <$sender_address>)\n\t}}\
  ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
  id $message_exim_id\
  ${if def:received_for {\n\tfor $received_for}}

The information is taken from the official Exim documentation at the link
https://www.exim.org/exim-html-current/doc/html/sp...
(search on the received_header_text directive page)
The somedomain domain is edited by simply changing /etc/hostname

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question