Advertisement
dmellis

email form

Mar 26th, 2011
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.62 KB | None | 0 0
  1. <?php
  2. /***************************************************\
  3.  * PHP 4.1.0+ version of email script. For more
  4.  * information on the mail() function for PHP, see
  5.  * http://www.php.net/manual/en/function.mail.php
  6. \***************************************************/
  7.  
  8.  
  9. // First, set up some variables to serve you in
  10. // getting an email.  This includes the email this is
  11. // sent to (yours) and what the subject of this email
  12. // should be.  It's a good idea to choose your own
  13. // subject instead of allowing the user to.  This will
  14. // help prevent spam filters from snatching this email
  15. // out from under your nose when something unusual is put.
  16.  
  17. $sendTo  = "dmellis@nyc.rr.com, melon@talesfromthehead.com";
  18. $subject = "Post-Introduction Comments";
  19.  
  20. // variables are sent to this PHP page through
  21. // the POST method.  $_POST is a global associative array
  22. // of variables passed through this method.  From that, we
  23. // can get the values sent to this page from Flash and
  24. // assign them to appropriate variables which can be used
  25. // in the PHP mail() function.
  26.  
  27.  
  28. // header information not including sendTo and Subject
  29. // these all go in one variable.  First, include From:
  30. $headers = "From: contact@sundayatnoon.com" . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">\r\n";
  31. // next include a replyto
  32. $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
  33. // often email servers won't allow emails to be sent to
  34. // domains other than their own.  The return path here will
  35. // often lift that restriction so, for instance, you could send
  36. // email to a hotmail account. (hosting provider settings may vary)
  37. // technically bounced email is supposed to go to the return-path email
  38. // THIS NEXT LINE ONLY KILLS MY NICE LINE BREAKS.
  39. //$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
  40. $headers .= "Return-path: " . $_POST["email"];
  41.  
  42. // now we can add the content of the message to a body variable
  43. $message = $_POST["message"] . "\r\nName: " . $_POST["theName"] . "\r\nIntroduction Name: " . $_POST["introductionName"] . "\r\nVenue: " . $_POST["venue"] . "\r\nDate Start Time: " . $_POST["startTime"] . "\r\nDate End Time: " . $_POST["endTime"] . "\r\nEnjoyed Date?: " . $_POST["enjoy"] . "\r\nNature of Conversation: " . $_POST["conversation"] . "\r\nAppearance: " . $_POST["appearance"] . "\r\nWould like to date again?: " . $_POST["again"] . "\r\nOverall Comments: " . $_POST["overallComments"] . "\r\nWhat time to discuss: " . $_POST["whatTime"];
  44.  
  45. // once the variables have been defined, they can be included
  46. // in the mail function call which will send you an email
  47. mail($sendTo, $subject, $message, $headers);
  48.  
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement