-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsend.php
More file actions
executable file
·38 lines (35 loc) · 1.13 KB
/
send.php
File metadata and controls
executable file
·38 lines (35 loc) · 1.13 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
<META http-equiv="refresh" content="5;URL=http://www.pi.hemshrestha.com.np">
<?php
$errors = '';
$myemail = 'contact@hemshrestha.com.np';
if(empty($_POST['cnt_fname']) ||
empty($_POST['cnt_email']) ||
empty($_POST['cnt_msg']))
{
$errors .= "Error: all fields are required";
}
$name = $_POST['cnt_fname'];
$email_address = $_POST['cnt_email'];
$message = $_POST['cnt_msg'];
//if (!preg_match("/ ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",$email_address)){
// $errors .= "\n Error: Invalid email address";
//}
if( empty($errors))
{
$to = $myemail;
$email_subject = "Request from : {$name}";
$email_body = "You have received a new message. ".
" Here are the details:\n Name: {$name} \n ".
"Email: {$email_address}\n Message \n {$message}";
$headers = "From: {$myemail}\n";
$headers .= "Reply-To: {$email_address}";
if(mail($to,$email_subject,$email_body,$headers)){
echo "Your request is on the progress now. We will reply you soon.";
}
else{
echo "Error in submission.";
}
}
else echo $errors;
?>
<br/><br/><br/>You will be redirected in 5 seconds.