Working on a site for non profit consumer organization. The site has a complaint form. When a complaint form is filled out, the script should send an email back to the user to let him know complaint was received. Another email is sent to notify the organization that a complaint was filed. The script also inserts the information into a MySQL database. My problem is that the email to the organization is not getting sent. The email to the user is sent out fine and everything else works. I researched the mail(); function at the php.net site and got the information from there. The code is as follows:
The first part of the code below is for sending the email back to the user to let it be known the complaint was received. This part IS working correctly:
$todays_date = date("F jS Y");
$to = "$email";
$subject = "Your Complaint Has Been Received";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "To: $first_name <$email>\r\n";
$headers .= "From: Organization's Name <noreply@ourwebsite.com>\r\n";
$msg ="message to user goes here";
mail($to, $subject, $msg, $headers);
I ommited the message portion to keep post small.
Now this part WILL NOT send an email and I cannot find any reason why not:
$todays_date = date("F jS, Y");
$to = "someone@ourwebsite.com";
$subject = " Complaint Has Been Filed";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "To: Someone <someone@ourwebsite.com>\r\n";
$headers .= "From: $first_name $last_name <$email>\r\n";
$msg = "The following information has been submitted by $first_name $last_name";
mail($to, $subject, $msg, $headers);