Guest User

Untitled

a guest
Mar 28th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <?php
  2. define('EMAIL_TO', '[email protected]');
  3. define('EMAIL_SUBJECT', 'Обратная связь');
  4.  
  5. $data = isset($_POST['d']) ? @json_decode($_POST['d'], true) : array();
  6.  
  7. $headers = "";
  8. $headers .= "X-Priority: 3\r\n";
  9. $headers .= "MIME-Version: 1.0\r\n";
  10. $headers .= "Content-Type: text/plain; charset=\"" . "utf-8" . "\"\r\n";
  11. $headers .= "Content-Transfer-Encoding: 8bit\r\n";
  12.  
  13. $body = "";
  14.  
  15. if ($data) {
  16. foreach($data as $field) {
  17. $title = @strip_tags($field['title']);
  18. $value = @strip_tags($field['value']);
  19. $body .= sprintf("%s: %s\r\n", $title, $value);
  20. }
  21.  
  22. $mail = @mail(EMAIL_TO, EMAIL_SUBJECT, $body, $headers);
  23. }
  24.  
  25. if ($mail) {
  26. die(json_encode(array("success" => "Спасибо! Ваша заявка принята.")));
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment