PHP 7
Perfect-v2.0.0.php Guest on 20th November 2020 05:20:10 AM
  1. <?php
  2. //////////////////////////////////////////////////////////////
  3. // PERFECT (PHP Email Receive Form Electronic Content Text) //
  4. // Version: 2.0 (October 22, 2016)                          //
  5. // Description: Process a web form to read the user input   //
  6. //    and then send the data to a predefined recipient.     //
  7. // Instructions: https://centerkey.com/php                  //
  8. // License: MIT or WTFPL (your choice)                      //
  9. //////////////////////////////////////////////////////////////
  10.  
  11. // Configuration settings
  12. $sendFrom =    "Form Feedback <[email protected]>";
  13. $sendTo =      "[email protected]";
  14. $subjectLine = "Feedback Submission";
  15. $thanksUrl =   "thanks.html";  //confirmation page
  16.  
  17. // Build message body from web form input
  18. foreach ($_POST as $field=>$value)
  19.    $msgBody .= "$field: $value\n";
  20. $msgBody .= "\n" . @gethostbyaddr($_SERVER["REMOTE_ADDR"]);
  21. $msgBody = htmlspecialchars($msgBody, ENT_NOQUOTES);  //make safe
  22.  
  23. // Send email and direct browser to confirmation page
  24. mail($sendTo, $subjectLine, $msgBody, "From: $sendFrom");
  25. header("Location: $thanksUrl");
  26. ?>

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Recent Pastes

Raw Paste

Login or Register to edit or fork this paste. It's free.