I am sure I am missing something really simple here but I cant seem to figure out what is wrong with my php email function. Any help would be greatly appreciated.
$to = "mz@foo.com";
$from = "mr@foo.com";
$subject = "test";
$message = "This email was registered at ". $users_email;
$message .= " on ".date('l jS \o\n F Y h:i:s A');
$headers = "";
$headers = 'Content-Type: text/plain\r\n';
$headers .= "From: $from \r\n";
$headers .= "Reply-To: $from\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
Attached to this is a form that asks users to just ask their email address. It then uses this and reloads the page with the variable set and sets up the email. I have left the validation out of here but I have a validation function. It sends the email but always says the email is sent from anonymous@foo.com. Am I missing something here?
Try adding “Return-path: $from\r\n” .
Shai.