Guest User

Untitled

a guest
Mar 1st, 2018
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <input type="hidden" name="project_name" value="3wit.ru">
  2. <input type="hidden" name="admin_email" value="lianaza@mail.ru">
  3. <input type="hidden" name="form_subject" value="Заявка на кровать">
  4.  
  5. $method = $_SERVER['REQUEST_METHOD'];
  6.  
  7. //Script Foreach
  8. $c = true;
  9. if ( $method === 'POST' ) {
  10.  
  11. $project_name = trim($_POST["project_name"]);
  12. $admin_email = trim($_POST["admin_email"]);
  13. $form_subject = trim($_POST["form_subject"]);
  14.  
  15.  
  16.  
  17. foreach ( $_POST as $key => $value ) {
  18. if ( $value != "" && $key != "project_name" && $key != "admin_email" && $key != "form_subject" ) {
  19. $message .= "
  20. " . ( ($c = !$c) ? '<tr>':'<tr style="background-color: #f8f8f8;">' ) . "
  21. <td style='padding: 30px; border: #e9e9e9 1px solid;'><b>$key</b></td>
  22. <td style='padding: 30px; border: #e9e9e9 1px solid;'>$value</td>
  23. </tr>
  24. ";
  25. }
  26. }}
  27.  
  28. function adopt($text) {
  29. return '=?UTF-8?B?'.Base64_encode($text).'?=';
  30. }
  31.  
  32. $headers = "MIME-Version: 1.0" . PHP_EOL .
  33. "Content-Type: text/html; charset=utf-8" . PHP_EOL .
  34. 'From: '.adopt($project_name).' <lianaza@mail.ru>' . PHP_EOL .
  35. 'Reply-To: lianaza@mail.ru' . PHP_EOL;
  36.  
  37. mail($admin_email, adopt($form_subject), $message, $headers );
Add Comment
Please, Sign In to add comment