-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail.php
More file actions
27 lines (25 loc) · 786 Bytes
/
mail.php
File metadata and controls
27 lines (25 loc) · 786 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
<?php
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$message = '';
foreach (array(
'name',
'email',
) as $key) {
if (!empty($_POST[$key])) {
$message .= $key . ": ".clean_string($_POST[$key]) . PHP_EOL;
}
}
$email_to = 'tennalian@gmail.com';
$email_from = 'robot@forexatlas.com';
$email_subject = 'Обратный звонок c NavalnyStrategy'.$_SERVER['SERVER_NAME'];
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'Content-Type:text/html;charset=utf-8'."\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email_to, $email_subject, $message, $headers);
die(json_encode(array('result'=>true, 'text'=>'Thank you')));
?>