coldwerturkey;10909606 wrote:(if you still feel it's your code; you can rule it out by seeing if mail() returns false
$mail = mail(...);
if (!$mail) die('its mail()');
)
Aha, I think I nailed down what the problem is. As I suspected it had something to do with $extra_headers. Ok, so here is thing: before it was:
if(empty($error_list)) {
$email_contents = "The following message was sent to you from your website:\n\n ";
$email_contents .= "First Name: $fname\n ";
$email_contents .= "Last name: $lname\n ";
$email_contents .= "Email: $email\n\n ";
$email_contents .= "$subject \n\n ";
$email_contents .= $message;
$extra_headers = "From: $fname <$email>\n\n";
$extra_headers .= "Reply-To: $email";
mail('dimitrifsb@gmail.com' ,'Contact Form Submission', $email_contents, $extra_headers);
$status = "<ul><li>Message Sent. Thanks, $fname! </li></ul>";
$display_form = false;
}
I got rid of:
$extra_headers = "From: $fname <$email>\n\n";
So now email arrives from "Nobody" but it seems to at least arrive consistently.
I have tried using just $fname or $email but it still has same problem. It seems that problem goes away if if just comment out the entire line.
Does anyone know the correct syntax to get the header "from" to display correctly?
Also, I still wonder why it worked sometime and not the other with the line there.
Weird.