Advertisement
kevrama

contact.php

May 13th, 2013
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. <?php
  2.  
  3. if ($_SERVER['REQUEST_METHOD'] == 'POST')
  4. {
  5. //we need to get our variables first
  6.  
  7. $email_to = 'my-email-address@mail.ru'; //the address to which the email will be sent
  8. $email = $_POST['email'];
  9. $name = $_POST['name'];
  10. $subject = $_POST['subject'];
  11. $tel = $_POST['tel'];
  12. $message = $_POST['message'];
  13.  
  14.  
  15. $message = "\nNaam = $name \nE-mailadres = $email \nOnderwerp = $subject \nTelefoonnummer = $tel \nBericht = $message";
  16. // Echo "Name: $FirstNam . \tEmail Address: $Email " ;
  17.  
  18.  
  19.  
  20. /*the $header variable is for the additional headers in the mail function,
  21. we are asigning 2 values, first one is FROM and the second one is REPLY-TO.
  22. That way when we want to reply the email gmail(or yahoo or hotmail...) will know
  23. who are we replying to. */
  24. $headers = "MIME-Version: 1.0" . "\r\n";
  25. $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
  26. $headers = "From: ".$email ."\r\n";
  27. $headers .= "Reply-To: $email\r\n";
  28.  
  29. if(mail($email_to, $name, $message, $headers)){
  30. echo 'ok'; // we are sending this text to the ajax request telling it that the mail is sent..
  31. }else{
  32. echo 'failed';// ... or this one to tell it that it wasn't sent
  33. }
  34. }
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement