-
Notifications
You must be signed in to change notification settings - Fork 0
/
mail.php
52 lines (42 loc) · 1.3 KB
/
mail.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
51
52
<?php
if( empty( $_POST['token'] ) ){
echo '<span class="notice">Error!</span>';
exit;
}
if( $_POST['token'] != 'FsWga4&@f6aw' ){
echo '<span class="notice">Error!</span>';
exit;
}
$name = $_POST['name'];
$from = $_POST['email'];
$phone = $_POST['phone'];
$subject = stripslashes( nl2br( $_POST['subject'] ) );
$message = stripslashes( nl2br( $_POST['message'] ) );
$headers ="From: Form Contact <$from>\n";
$headers.="MIME-Version: 1.0\n";
$headers.="Content-type: text/html; charset=iso 8859-1";
ob_start();
?>
Hi Harpreet Singh!<br /><br />
<?php echo ucfirst( $name ); ?> has sent you a message via contact form on your website!
<br /><br />
Name: <?php echo ucfirst( $name ); ?><br />
Email: <?php echo $from; ?><br />
Phone: <?php echo $phone; ?><br />
Subject: <?php echo $subject; ?><br />
Message: <br /><br />
<?php echo $message; ?>
<br />
<br />
============================================================
<?php
$body = ob_get_contents();
ob_end_clean();
$to = '[email protected]';
$s = mail($to,$subject,$body,$headers,"-t -i -f $from");
if( $s == 1 ){
echo '<div class="success"><i class="fas fa-check-circle"></i><h3>Thank You!</h3>Your message has been sent successfully.</div>';
}else{
echo '<div>Your message sending failed!</div>';
}
?>