- filter_var: documentation ( source)
- mail: documentation ( source)
<?php
if(empty($_POST['name']) ||
empty($_POST['emailz']) ||
empty($_POST['phone']) ||
empty($_POST['message']) ||
!filter_var($_POST['emailz'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!!";
return false;
}
$name = $_POST['name'];
$email = $_POST['emailz'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$headers = "From: noreply@yourdomain.com\n"; // This is the email address the generated message will be from
$headers .= "Reply-To: $emailz";
$subject = 'New Message - Kieronboz.co.uk - $name';
$body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $emailz\n\nPhone: $phone\n\nMessage:\n$message";
mail("kieronboz@gmail.com",$subject,$body,$headers);
return true;
?>