Jump to content

mail() / sendmail / local domain issue


zims15

Recommended Posts

Hi there,

 

I have a web host with an associated domain name (mydomain.com). The A record for the domain name points to the web host. The MX record for the same domain name points to a different server, as the mail is hosted elsewhere.

 

On the web server, I have a PHP script that uses the mail() function to send email. The recipient address in the script uses the same domain name as above ([email protected]). However, when the mail() function is executed, the MX record of the domain name is ignored, and the SMTP agent on the web server attempts to deliver the email to its own local mailbox, which doesn't exist. As soon as I change the recipient address to an external domain, everything works as it should.

 

The strange thing is, the mail() call does not seem to return anything; the entire script just stops there, without any warnings or errors of any kind (regardless of the reporting level). The following produces no output:

 

if (mail($email_to, $email_subject, $email_message, $email_headers) === TRUE) {
    print("success");
}
else {
    print("failure");
}

 

Any help is appreciated!

 

--

zims

Link to comment
https://forums.phpfreaks.com/topic/88433-mail-sendmail-local-domain-issue/
Share on other sites

Did you check that your mail() setting is enabled in the .ini settings. Try to test the mail function and see what is happening. If it's working try to check your host:........ which you are using. You have already finished send_mail.php scripts on the web.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.