SHARE
TWEET

contact form not submitting

a guest Oct 21st, 2015 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. if(isset($_POST['message'])){
  4.  
  5.         $name = $_POST['name'];
  6.         $email = $_POST['email'];
  7.         $message = $_POST['message'];
  8.    
  9.        
  10.         $to      = 'example@gmail.com';
  11.         $subject = 'Site Contact Form';
  12.  
  13.         $headers = 'From: '. $email . "\r\n" .
  14.     'Reply-To: '. $email . "\r\n" .
  15.     'X-Mailer: PHP/' . phpversion();
  16.  
  17.         $status = mail($to, $subject, $message, $headers);
  18.  
  19.         if($status == TRUE){   
  20.                 $res['sendstatus'] = 'done';
  21.        
  22.                 //Edit your message here
  23.                 $res['message'] = 'Thanks for the message! I will be in touch soon.';
  24.     }
  25.         else{
  26.                 $res['message'] = 'Failed to send mail. Please email me at example@gmail.com instead';
  27.         }
  28.        
  29.        
  30.         echo json_encode($res);
  31. }
  32.  
  33. ?>
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