SHARE
TWEET

contactphp

a guest Sep 19th, 2019 4 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // check if fields passed are empty
  3. if(empty($_POST['name'])      ||
  4.    empty($_POST['city'])      ||
  5.    empty($_POST['email'])     ||
  6.    empty($_POST['phonenumber'])     ||
  7.    empty($_POST['message'])   ||
  8.    !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
  9.    {
  10.    echo "No arguments Provided!";
  11.    return false;
  12.    }
  13.    
  14. $name = $_POST['name'];
  15. $city = $_POST['city'];
  16. $email_address = $_POST['email'];
  17. $phone = $_POST['phonenumber'];
  18. $message = $_POST['message'];
  19.    
  20. // create email body and send it
  21. $to = 'xxxx@gmail.com'; // *REPLACE WITH THE EMAIL ADDRESS YOU WANT THE FORM TO SEND MAIL TO*
  22. $email_subject = "Message de votre site de la part de :  $name";
  23. $email_body = "Vous avez reçu un nouveau message.\n\n"."Voici les détails:\n\nName: $name\n\nEmail: $email_address\n\Tel: $phone\n\nMessage:\n$message";
  24. $headers = "From: noreply@xxxxx.fr\n"; // *REPLACE WITH THE EMAIL ADDRESS YOU WANT THE MESSAGE TO BE FROM*
  25. $headers .= "Reply-To: $email_address";
  26. mail($to,$email_subject,$email_body,$headers);
  27. return true;
  28. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top