Hi,
I have totally rewritten your code and tested it.
<?php
header("Expires: Mon, 20 Dec 1998 01:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
$message = $_REQUEST["enquiry"];
$name = $_REQUEST["name"];
$phone = $_REQUEST["phone"];
$email = $_REQUEST["email"]; // optional
$contents = <<<EOD
Name: $name
Phone: $phone
Message: $message
EOD;
if (empty($phone) || empty($message) || empty($name)) {
header("Location: http://www.garethgillman.co.uk/contact.php");
}
else {
if(!isset($email)) {
$email = "webform@sglettings.co.uk";
}
$headers = "From: $name <$email>\r\n" .
"Reply-To: $email\r\n";
if(mail("info@sglettings.co.uk", "Contact Form Results", $contents, $headers)) {
header("Location: /sent.php");
exit;
}
else {
header("Location: /error.php");
exit;
}
}
?>
Any issues let me know,
Kyle