Advertisement
gitlez

YA: 20140311165634AAHSwKV

Mar 11th, 2014
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1. <?php
  2.  
  3. // Yahoo Answer for http://answers.yahoo.com/question/index?qid=20140311165634AAHSwKV
  4.  
  5. $usrEmail = $_POST['email']; // Store it in a variable so that you can add security, more easily, later.
  6. $usrName = $_POST['name'];
  7. $usrPhone = $_POST['phone'];
  8. $usrMessage = $_POST['message'];
  9.  
  10.  
  11. $ToEmail = 'noSpam@hotmail.com';
  12. $EmailSubject = 'Message from Business';
  13.  
  14. $mailheader = "From: " . $usrEmail . "\r\n";
  15. $mailheader .= "Reply-To: " . $usrEmail . "\r\n";
  16. $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
  17.  
  18. $MESSAGE_BODY = "name: " . $usrName . "";
  19. $MESSAGE_BODY .= "email: " . $usrEmail . "";
  20. $MESSAGE_BODY .= "phone: " . $usrPhone . "";
  21. $MESSAGE_BODY .= "message: " . nl2br($usrMessage) . "";
  22.  
  23. if( mail( $ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) ){
  24.     header ("Location: http://www.google.com/");
  25.     // Placing the header() call causes the script to stop processing and output the change of location header
  26.     // This way, it will only redirect on successful mail sent.
  27. }else {
  28.     echo "Failure";
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement