How to change IP to send mail through php mail()?

0 like 0 dislike
8 views
Good afternoon, dear community,

There is such problem: on the server (debian) installed apache and on it hangs a website on a certain IP (hereinafter IP2). Only on the server konfigurera 2 IP (hereinafter IP1 and IP2).
In /etc/network/interfaces eth0 is listed as IP1 and IP2 as eth0:0.

Through the website (which runs on IP2) with mail() to send mail. In the header of incoming mail contains such a line:
Received: from www-data by mail.XXXXXX.com with local (Exim 4.69),
where mail.XXXXXX.com — reverse DNS to IP1. There's also other titles featured IP1.

I need to have mail sent via IP2. And in headlines everywhere appeared IP2, not IP1. How to do it?

PS I'm not a sysadmin, and many do not know the intricacies. But what we have now — set up itself.

P. P. S. Found in Exim settings setting the System Mail Name, but there you can only specify one address it seems.
by | 8 views

2 Answers

0 like 0 dislike
PHP sends mail from sendmail client. And IP, which will be delivered to the mail is a server configuration option, ie PHP is unable to influence it in principle. From PHP you can only send via different servers on different IP. Accordingly, you need to raise a few mta on a different IP. But to send through them it is necessary will not function mail(), and class sending via smtp.
by
0 like 0 dislike
Might help the option interface=x.y.z.w in exim.conf.
by

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
asked May 4, 2019 by raebg
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
28,667 users