Hi,
This is not exactly a coding problem, more of an email server problem. I'm trying to send out an email from my PHP script using mail(). I know that the problem isn't with the mail() code or my server, as I can properly send out e-mails using the script. However, when I try to send a server to a particular domain (which is my client's set of e-mail addresses, all with the same domain), they never get received.
I've received the e-mails at other domains, and then tried forwarding an exact copy to my client's domain and it works. So I've concluded that, for some reason, the recipient e-mail server is rejecting the e-mails when sent directly using the mail() function.
Is there any reason why a server would do this? Is an e-mail sent using mail() formatted differently somehow that would cause it to be rejected? The recipient email server is probably being picky about something, but still I'd like to see if there's something I can do.
Here's the code. I've tried various things including only including taking out the $header parameter (e-mail addresses have been changed for privacy):
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Reply-To: sender@domain.com\r\n";
$headers .= "From: sender@domain.com";
$address = "recipient@rec-domain.com";
$subject = "New Contact";
$body = "New contact.<br>";
if(!mail($address, $subject, $body, $headers) )
{
$return = '<div id="response_fail">
There was an error sending your e-mail. Please try again later.
</div>';
}