Advertisement
Guest User

LuMendoza

a guest
Oct 16th, 2013
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <?php
  2. // check if fields passed are empty
  3. if(empty($_POST['name']) ||
  4. empty($_POST['email']) ||
  5. empty($_POST['message']) ||
  6. !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
  7. {
  8. echo "No arguments Provided!";
  9. return false;
  10. }
  11.  
  12. $name = $_POST['name'];
  13. $email_address = $_POST['email'];
  14. $message = $_POST['message'];
  15.  
  16. // create email body and send it
  17. $to = 'reparaciones.lu@gmail.com'; // put your email
  18. $email_subject = "Contact form submitted by: $name";
  19. $email_body = "You have received a new message. \n\n".
  20. " Here are the details:\n \nName: $name \n ".
  21. "Email: $email_address\n Message \n $message";
  22. $headers = "From: contacts@myprogrammingblog.com\n";
  23. $headers .= "Reply-To: $email_address";
  24. mail($to,$email_subject,$email_body,$headers);
  25. return true;
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement