\n";
// check to see if a name was entered
if (!$_POST['Name'])
$errors[] = "Name is required";
// if there are any errors, display them
$email = stripslashes($_POST['mailadd']);
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email))
$errors[] = "Invalid Email Address";
if (count($errors)>0) {
foreach($errors as $err)
echo "$err
\n";
echo "
Please use your browser's Back button to fix.";
} else {
// no errors, so we build our message
switch($_POST['type']){
case 'sales':
$recipient = 'info@ang.co.za';
break;
case 'info':
$recipient = 'info@ang.co.za';
break;
case 'support':
$recipient = 'info@ang.co.za';
break;
default:
$recipient = 'info@ang.co.za';
}
$subject = "Website Email Enquiry";
$from = stripslashes($_POST['Name']);
$msg = "Message sent by $from\n";
$msg.="\n".stripslashes($_POST['MsgBody'])."\n";
if (mail($recipient,$subject,$msg,"From: $email\n")){
echo "
Thank You! We will be contacting you shortly!
";
echo nl2br($msg);
} else
echo "An unknown error occurred.";
}
}
?>