-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact_me.php
26 lines (22 loc) · 929 Bytes
/
contact_me.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
// check if fields passed are empty
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['message'])||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!"; return false;
}
$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];
// create email body and send it
$to = '[email protected]';
// put your email
$email_subject = "Contact form submitted by: $name"; $email_body = "You have received a new message. \n\n".
" Here are the details:\n \nName: $name \n ".
"Email: $email_address\n Message \n $message";
$headers = "From: [email protected]\n";
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers); return true;
?>