Project

General

Profile

1
<?php
2
// Check for empty fields
3
if(empty($_POST['name'])  		||
4
   empty($_POST['email']) 		||
5
   empty($_POST['phone']) 		||
6
   empty($_POST['message'])	||
7
   !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
8
   {
9
	echo "No arguments Provided!";
10
	return false;
11
   }
12
	
13
$name = $_POST['name'];
14
$email_address = $_POST['email'];
15
$phone = $_POST['phone'];
16
$message = $_POST['message'];
17
	
18
// Create the email and send the message
19
$to = 'yourname@yourdomain.com'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
20
$email_subject = "Website Contact Form:  $name";
21
$email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nPhone: $phone\n\nMessage:\n$message";
22
$headers = "From: noreply@yourdomain.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
23
$headers .= "Reply-To: $email_address";	
24
mail($to,$email_subject,$email_body,$headers);
25
return true;			
26
?>
    (1-1/1)