-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
email.php
executable file
·44 lines (35 loc) · 1.07 KB
/
email.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
<?php
if ( ( $_POST['url'] == 'https://example.com/' ) && ( stripos( $_POST['message'], 'http' ) === false ) ) {
$to = '[email protected]';
$subject = 'New Message from Company Name';
$name = trim( stripslashes( htmlspecialchars( $_POST['sign'] ) ) );
$email = trim( stripslashes( htmlspecialchars( $_POST['email'] ) ) );
$phone = trim( stripslashes( htmlspecialchars( $_POST['phone'] ) ) );
$message = trim( stripslashes( htmlspecialchars( $_POST['message'] ) ) );
$validated = true;
if ( !$validated ) {
print '<meta http-equiv="refresh" content="0;url=fail">';
exit;
}
$body = '';
$body .= 'Name: ';
$body .= htmlspecialchars_decode( $name );
$body .= "\n";
$body .= 'Email: ';
$body .= $email;
if ( $_POST['phone'] ) {
$body .= "\n";
$body .= 'Phone: ';
$body .= $phone;
}
$body .= "\n\n";
$body .= htmlspecialchars_decode( $message );
$body .= "\n";
$success = mail( $to, $subject, $body, "From: $name <$email>" );
if ( $success ) {
print '<meta http-equiv="refresh" content="0;url=success">';
} else {
print '<meta http-equiv="refresh" content="0;url=fail">';
}
}
?>