Ok, so I'm kinda stumped and could really use some help. I set up a PHP mail script on my own server and everything worked great. Then when I moved it to my client's server, one of the email addresses in the script no longer receives the generated message. There are 6 recipients in total on various domains including google, godaddy, etc. All of the email addresses received the PHP mail when the script was hosted on my own server, but one of them stopped receiving the PHP mail once I moved the script to my client's server.
I am providing a copy of the script and the bounceback message that was received once I moved the script over (email addresses omitted for privacy). I am able to send messages directly from my email address to the recipient, however I cannot use the script to do it. Any suggestions on why this is happening? Thanks in advance!
$to = "email@example.com,firstname.lastname@example.org,email@example.com,firstname.lastname@example.org";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "email@example.com";
$headers = "From:" . $from;
echo "Mail Sent.";
I received this bounceback after transferring the script to the client's server:
[I]This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
No Such User Here
------ This is a copy of the message, including all the headers. ------
Received: from username by hostingserver.com with local (Exim 4.69)
id 1UAqjf-0000Jp-KV; Wed, 27 Feb 2013 18:48:31 -0500
Subject: Test mail
Date: Wed, 27 Feb 2013 18:48:31 -0500
Hello! This is a simple email message.[/I]
Ok, so I have fixed the problem. After extensive research and investigation, the issue stems from the client's email being hosted on a different server than the website and is not connected to the php code in any way. The hosting server, being a dumb robot, assumes that because the client's website and email both have the same domain name that they are both hosted on the same web hosting server, and therefore tries to send the message locally. I found the setting in the control panel for the client's web hosting where I can change it from a local mail exchange to a remote mail exchange. This told the client's web server to send the email out into the net and allow the email to direct itself to the proper location, rather than just dumping it into a non-existent email account on the client's web hosting server.