Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <?php
  2.  
  3. $method = $_SERVER['REQUEST_METHOD'];
  4.  
  5. //Script Foreach
  6. $c = true;
  7. if ( $method === 'POST' ) {
  8.  
  9. $project_name = trim($_POST["project_name"]);
  10. $admin_email = trim($_POST["admin_email"]);
  11. $form_subject = trim($_POST["form_subject"]);
  12.  
  13. foreach ( $_POST as $key => $value ) {
  14. if ( $value != "" && $key != "project_name" && $key != "admin_email" && $key != "form_subject" ) {
  15. $message .= "
  16. " . ( ($c = !$c) ? '<tr>':'<tr style="background-color: #f8f8f8;">' ) . "
  17. <td style='padding: 10px; border: #e9e9e9 1px solid;'><b>$key</b></td>
  18. <td style='padding: 10px; border: #e9e9e9 1px solid;'>$value</td>
  19. </tr>
  20. ";
  21. }
  22. }
  23. } else if ( $method === 'GET' ) {
  24.  
  25. $project_name = trim($_GET["project_name"]);
  26. $admin_email = trim($_GET["admin_email"]);
  27. $form_subject = trim($_GET["form_subject"]);
  28.  
  29. foreach ( $_GET as $key => $value ) {
  30. if ( $value != "" && $key != "project_name" && $key != "admin_email" && $key != "form_subject" ) {
  31. $message .= "
  32. " . ( ($c = !$c) ? '<tr>':'<tr style="background-color: #f8f8f8;">' ) . "
  33. <td style='padding: 10px; border: #e9e9e9 1px solid;'><b>$key</b></td>
  34. <td style='padding: 10px; border: #e9e9e9 1px solid;'>$value</td>
  35. </tr>
  36. ";
  37. }
  38. }
  39. }
  40.  
  41. $message = "<table style='width: 100%;'>$message</table>";
  42.  
  43. function adopt($text) {
  44. return '=?UTF-8?B?'.Base64_encode($text).'?=';
  45. }
  46.  
  47. $headers = "MIME-Version: 1.0" . PHP_EOL .
  48. "Content-Type: text/html; charset=utf-8" . PHP_EOL .
  49. 'From: '.adopt($project_name).' <'.$admin_email.'>' . PHP_EOL .
  50. 'Reply-To: '.$admin_email.'' . PHP_EOL;
  51.  
  52. mail($admin_email, adopt($form_subject), $message, $headers );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement