Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <?php
  2. $subject = 'Message from Website'; // Subject of your email
  3. $to = 'me@mydomain.com'; //Recipient's E-mail
  4. $emailTo = $_REQUEST['email'];
  5.  
  6. $headers = "MIME-Version: 1.1";
  7. $headers .= "Content-type: text/html; charset=iso-8859-1";
  8. $headers .= "From: " . $emailTo . "rn"; // Sender's E-mail
  9. $headers .= "Return-Path:". $emailTo;
  10.  
  11. $message .= 'Name : ' . $_REQUEST['name'] . "n";
  12. $message .= 'Email : ' . $_REQUEST['email'] . "n";
  13. $message .= 'Phone : ' . $_REQUEST['phone'] . "n";
  14. $message .= 'Message : ' . $_REQUEST['message'];
  15.  
  16. if (@mail($to, $subject, $message, $headers))
  17. {
  18. // Transfer the value 'sent' to ajax function for showing success message.
  19. echo 'sent';
  20. }
  21. else
  22. {
  23. // Transfer the value 'failed' to ajax function for showing error message.
  24. echo 'failed';
  25. }
  26. ?>
  27.  
  28. // To send HTML mail, the Content-type header must be set
  29. $headers = 'MIME-Version: 1.0' . "rn";
  30. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
  31.  
  32. // Additional headers
  33. $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "rn";
  34. $headers .= 'From: Birthday Reminder <birthday@example.com>' . "rn";
  35. $headers .= 'Cc: birthdayarchive@example.com' . "rn";
  36. $headers .= 'Bcc: birthdaycheck@example.com' . "rn";
  37.  
  38. // Mail it
  39. mail($to, $subject, $message, $headers);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement