Browser error with PHP email script
Posted: Tue Jan 05, 2010 6:53 am
I keep getting an error when I run the following PHP script. The browser says there is an error on line 53 - which is the mail($EmailTo,$Subject,$Body,$name); line, but I can't see anything wrong there, or subsequently.
Can anybody help me out with where I'm going wrong?
Thanks!
<?php
$EmailFrom = $_POST['email'];
$EmailTo = 'relevant email address here';
$Subject = 'Contact Request';
$name = $_POST['name'];
$org = $_POST['org'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$comments = $_POST['comments'];
$mail_list = $_POST['mail_list'];
$headers = "From: " . $EmailFrom. "\r\n" . 'X-Mailer: PHP/' . phpversion('5.0');
$Body .= "---------------------------";
$Body .= "\n";
$Body .= "Name: ";
$Body .= $name;
$Body .= "\n";
$Body .= "Organisation: ";
$Body .= $org;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $address;
$Body .= "\n";
$Body .= "Contact number: ";
$Body .= $phone;
$Body .= "\n";
$Body .= "E-mail: ";
$Body .= $email;
$Body .= "\n";
$Body .= "Comments: ";
$Body .= $comments;
$Body .= "\n";
$Body .= "\n";
$Body .= "Mail List: ";
$Body .= $mail_list;
$Body .= "\n";
$Body .= "---------------------------";
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../tpollo.css" />
<title>T'Pollo - Great Northern Comedy</title>
</head>
<body>
<?php
mail($EmailTo,$Subject,$Body,$EmailTo);
echo("<p class=conf>Thank you. We will contact you shortly.<br />
<a href=../index.htm>Click here to return to the website.</a></p>");
?>
</body></html>
Can anybody help me out with where I'm going wrong?
Thanks!
<?php
$EmailFrom = $_POST['email'];
$EmailTo = 'relevant email address here';
$Subject = 'Contact Request';
$name = $_POST['name'];
$org = $_POST['org'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$comments = $_POST['comments'];
$mail_list = $_POST['mail_list'];
$headers = "From: " . $EmailFrom. "\r\n" . 'X-Mailer: PHP/' . phpversion('5.0');
$Body .= "---------------------------";
$Body .= "\n";
$Body .= "Name: ";
$Body .= $name;
$Body .= "\n";
$Body .= "Organisation: ";
$Body .= $org;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $address;
$Body .= "\n";
$Body .= "Contact number: ";
$Body .= $phone;
$Body .= "\n";
$Body .= "E-mail: ";
$Body .= $email;
$Body .= "\n";
$Body .= "Comments: ";
$Body .= $comments;
$Body .= "\n";
$Body .= "\n";
$Body .= "Mail List: ";
$Body .= $mail_list;
$Body .= "\n";
$Body .= "---------------------------";
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../tpollo.css" />
<title>T'Pollo - Great Northern Comedy</title>
</head>
<body>
<?php
mail($EmailTo,$Subject,$Body,$EmailTo);
echo("<p class=conf>Thank you. We will contact you shortly.<br />
<a href=../index.htm>Click here to return to the website.</a></p>");
?>
</body></html>