-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact.php
executable file
·50 lines (30 loc) · 1.07 KB
/
contact.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_message'];
$phone = $_POST['cf_phone'];
$mail_to = '[email protected]';
$subject = 'Message from a site visitor: '.$field_name;
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Phone: ' .$phone."\n";
$body_message .= 'Message: '.$field_message."\n";
// $headers = 'From: '.$field_email."\r\n";
// $headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
// Below stuff isn't completely necessary
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message! We will contact you shortly.');
window.location = 'http://slysbarbershop.com'
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to [email protected]');
window.location = 'http://slysbarbershop.com';
</script>
<?php
}
?>