Cannot send mails using php mail() function to domain with remote mail exchanger

m.ioannidis

Registered
Feb 19, 2014
2
0
1
cPanel Access Level
Root Administrator
Hello every one!

I'm facing a weird problem.
On a dedicated server I have WHM 11.40.1 (build 11).
PHP 5.4.23

I have an account set up lets say domain.com.
In its DNS zones, I have insert the necessary records for the hotmail MX records AND the Remote Mail Exchanger option on.
I 'm trying to send an email using mail('[email protected]', 'Test from Script', 'Test Text');

It should go to the hotmail servers. Right?

I get no errors in exim_mainlog.

Code:
2014-02-19 18:16:15 1WG9ol-0000Gk-46 <= [email protected] U=domain P=local S=371 T="Test from script" for [email protected]
2014-02-19 18:16:15 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1WG9ol-0000Gk-46
2014-02-19 18:16:15 cwd=/home/domain/public_html 3 args: /usr/sbin/sendmail -t -i
2014-02-19 18:16:15 1WG9ol-0000Gk-46 => domain <[email protected]> R=localuser T=local_delivery
2014-02-19 18:16:15 1WG9ol-0000Gk-46 Completed
The Mail Queue is empty.

The domain.com is NOT in /etc/localdomains and is ON the /etc/remotedomains.

If i dig MX domain.com, I get the lowest MX record pointing to <blah blah blah>.pamx1.hotmail.com. as expected.

But still no mail in hotmail accounts.

And now the weird staff:

If i run the php script through shell (root) access, the mail goes to hotmail account.

If I create a local mail account ([email protected]) and log in into it (via domain.com/webmail), I can see the message from the php script!

Any help would be great!

Thank you in advance.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello :)

Do you notice any difference if you send out a message using SMTP Authentication in your PHP script?

Thank you.
 

m.ioannidis

Registered
Feb 19, 2014
2
0
1
cPanel Access Level
Root Administrator
Thanks for the response!

Sending with SMTP is not an option at the moment.
The site was before working fine from an other server of mine. Since the transfer, the mail() function seems to have that issue.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Feel free to open a support ticket using the link in my signature so we can take a closer look. You can post the ticket number here so we can update this thread with the outcome.

Thank you.