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 (user@mydomain.com). 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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.