Guest User

Untitled

a guest
Oct 10th, 2018
110
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.  
  3. $name = trim($_POST['name']);
  4. $email = $_POST['email'];
  5. $phone = $_POST['phone'];
  6. $subject = $_POST['subject'];
  7. $message = $_POST['message'];
  8.  
  9. $site_owners_email = 'info@sprayandglow.com'; // Replace this with your own email address
  10. $site_owners_name = 'Christieanne'; // replace with your name
  11.  
  12. if (strlen($name) < 2) {
  13. return false;
  14. }
  15.  
  16. if (!preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*+[a-z]{2}/is', $email)) {
  17. return false;
  18. }
  19.  
  20. if (strlen($message) < 3) {
  21. return false;
  22. }
  23.  
  24. if (!$error) {
  25.  
  26. require_once('class.phpmailer.php');
  27. $mail = new PHPMailer();
  28.  
  29. $mail->From = $email;
  30. $mail->FromName = $name;
  31. $mail->Subject = "[$subject] SprayandGlow Contact Form";
  32. $mail->AddAddress($site_owners_email, $site_owners_name);
  33. $mail->Body = "Name: $name\n\nEmail: $email \n\nPhone: $phone \n\nMessage: $message";
  34.  
  35. // EDIT THIS!!
  36.  
  37. $mail->Mailer = "smtp";
  38. $mail->Host = "mail.sprayandglow.com";
  39. $mail->Port = 26;
  40.  
  41. $mail->SMTPAuth = true; // turn on SMTP authentication
  42. $mail->Username = "info@sprayandglow.com"; // SMTP username
  43. $mail->Password = "spray1234"; // SMTP password
  44.  
  45. $mail->Send();
  46.  
  47. echo "true";
  48.  
  49. } # end if no error
  50. else {
  51. echo "error";
  52. } # end if there was an error sending
  53.  
  54. ?>
Add Comment
Please, Sign In to add comment