I have the following code:
$to = "xxx@xxx.co.uk, xxx@xxx.co.uk";
$subject = "email submission from xxxxx.co.uk";
$content = array ( $title, $name, $surname, "<br>", $address, "<br>", $phone, "<br>", $cemail, "<br>", $message );
$val = implode(" ", $content);
$sender_name = "xxxxx.co.uk - booking submission";
$headers .= "From: \"".addslashes($sender_name)."\" <".$cemail.">\r\n";
$headers .= "Reply-To: ".$cemail."\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-Mailer: PHP / ".phpversion()."\r\n";
mail( $to, $subject, $val, $headers ) or print "Error handling message. message not sent.";
and I get this error message:
Notice: Undefined variable: headers in /dir/dir/dir/dir.com/user/htdocs/email.php on line 31
Line 31 is:
$headers .= "From: \"".addslashes($sender_name)."\" <".$cemail.">\r\n";
The script works. It sends the mail and the From field is correctly displayed in the email.
Any ideas why PHP is saying that $headers is undefined?
Many thanks!
R