-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend.php
More file actions
40 lines (34 loc) · 845 Bytes
/
Copy pathsend.php
File metadata and controls
40 lines (34 loc) · 845 Bytes
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
39
40
<?php
$errors = '';
$myemail = 'info@bitztrail.com';
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['message']))
{
$errors .= "\n Error: Required Field";
}
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = $_POST['subject'];
if (!eregi(
"^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",
$email))
{
$errors .= "\n Error: Invalid Email Address";
}
if( empty($errors))
{
$to = $myemail;
$email_subject = "A New Message Awaits: $subject";
$email_body = "You have received a new message. Details are given below.\n Name: $name \n Email: $email \n Message: \n $message";
$headers = "From: $email";
mail($to, $email_subject, $email_body, $headers);
?>
<script>
alert("message sent");
window.location="../contact-us/index.html"
</script>
<?php
}
?>