Advertisement
Guest User

Untitled

a guest
Feb 7th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. <?php
  2. /**
  3. * This example shows how to handle a simple contact form.
  4. */
  5.  
  6. $msg = '';
  7. //Don't run this unless we're handling a form submission
  8. if (array_key_exists('name', $_POST)) {
  9. date_default_timezone_set('Etc/UTC');
  10.  
  11. require '/home/wsiwaterproofing/public_html/PHPMailerAutoload.php';
  12.  
  13. //Create a new PHPMailer instance
  14. $mail = new PHPMailer;
  15. //Tell PHPMailer to use SMTP - requires a local mail server
  16. //Faster and safer than using mail()
  17. $mail->isSMTP();
  18. $mail->Host = 'rverser@wsiwaterproofingservices.com';
  19. $mail->SMTPAuth = true;
  20. $mail->SMTPSecure = 'tls';
  21. $mail->Mailer = "smtp";
  22. $mail->Port = 465;
  23. $mail->Username = "rverser@wsiwaterproofingservices.com";
  24. $mail->Password = "TESTHOTSPRINGS2";
  25.  
  26. //Use a fixed address in your own domain as the from address
  27. //**DO NOT** use the submitter's address here as it will be forgery
  28. //and will cause your messages to fail SPF checks
  29. $mail->setFrom('rverser@wsiwaterproofingservices.com', 'Ryan V');
  30. //Send the message to yourself, or whoever should receive contact for submissions
  31. $mail->addAddress('nnelly36@yahoo.com', 'Ryan V');
  32. //Put the submitter's address in a reply-to header
  33. //This will fail if the address provided is invalid,
  34. //in which case we should ignore the whole request
  35. if ($mail->addReplyTo($_POST['name'], $_POST['number'])) {
  36. $mail->Subject = 'New Request from WSI';
  37. //Keep it simple - don't use HTML
  38. $mail->isHTML(false);
  39. //Build a simple message body
  40. $mail->Body = <<<EOT
  41. Name: {$_POST['name']}
  42. Number: {$_POST['number']}
  43. Message: {$_POST['message']}
  44. EOT;
  45. //Send the message, check for errors
  46. if (!$mail->send()) {
  47. //The reason for failing to send will be in $mail->ErrorInfo
  48. //but you shouldn't display errors to users - process the error, log it on your server.
  49. $msg = 'Sorry, something went wrong. Please try again later.';
  50. } else {
  51. $msg = 'Message sent! Thanks for contacting us.';
  52. }
  53. } else {
  54. $msg = 'Invalid email address, message ignored.';
  55. }
  56. }
  57. header("Location: http://www.wsiwaterproofingservices.com/");
  58.  
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement