LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Web server sending e-mail to incorrect IP address, bypassing HOSTS file (https://www.linuxquestions.org/questions/linux-server-73/web-server-sending-e-mail-to-incorrect-ip-address-bypassing-hosts-file-4175451155/)

mmyles 02-21-2013 01:02 PM

Web server sending e-mail to incorrect IP address, bypassing HOSTS file
 
Hello. I have a web server running Centos 5.9 and Apache. One of our customers has a website that uses either PHP or Javascript to send out e-mails, but then Sendmail does not deliver it to the correct MX address. It appears as though it is ignoring the entry i have in the hosts file.
The MX server it needs to go to is on the same private subnet (192.168.190.x) as this web server, so I have the hosts file pointing mx1.domain.net to the private address.

Here are some examples detailing what I am seeing:

The hosts file shows the mx1.domain.net pointing to the correct private IP
Code:

root@fedweb etc# cat hosts
*Additional entries removed*
192.168.190.13  mx1.domain.net

And Pinging to mx1.domain.net Also brings up the correct IP address
Code:

root@fedweb etc# ping mx1.domain.net
PING mx1.domain.net (192.168.190.13) 56(84) bytes of data.

But the /var/log/maillog shows the e-mail attempting to go out to the Public IP address
Code:

Feb 21 10:06:29 fedweb sendmail[6830]: r1LI4TLF006828: to=<mmyles@domain.net>,
ctladdr=<apache@fedweb.domain.net> (48/48), delay=00:02:00, xdelay=00:02:00,
mailer=esmtp, pri=120685,
relay=mx1.domain.net. [123.456.123.456],
dsn=4.0.0,
stat=Deferred: Connection timed out with mx1.domain.net.

Is there a setting somewhere that tell Sendmail or Apache to ignore the HOSTS file?

whizje 02-21-2013 01:35 PM

change host to domain.net

mmyles 02-21-2013 02:42 PM

I'm sorry, your reply seemed kind of vague. Where would you want me to make this change?

whizje 02-21-2013 02:44 PM

In your hosts file change mx1.domain.net to domain.net

mmyles 02-21-2013 03:37 PM

Quote:

Originally Posted by whizje (Post 4896951)
In your hosts file change mx1.domain.net to domain.net

Not the exact fix, but got me in the right direction. Thank you.


All times are GMT -5. The time now is 04:40 PM.