Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <?php
  2.  
  3. if(isset($_POST['submit'])){
  4.  
  5. require 'PHPMailer/PHPMailerAutoload.php';
  6.  
  7. // Send mail
  8. $mail = new PHPMailer();
  9.  
  10. // Data received from POST request
  11. $name = stripcslashes($_POST['tbName']);
  12. $emailAddr = stripcslashes($_POST['tbEmail']);
  13. $company = stripcslashes($_POST['tbCompany']);
  14. $comment = stripcslashes($_POST['taMessage']);
  15. $subject = stripcslashes($_POST['tbSubject']);
  16.  
  17. // SMTP Configuration
  18. $mail->SMTPAuth = true;
  19. $mail->Host = "gator3209.hostgator.com"; // SMTP server
  20. $mail->Username = "****@*****.com";
  21. $mail->Password = "***********";
  22. $mail->SMTPSecure = 'tls';
  23. $mail->Port = 25;
  24.  
  25. $mail->AddAddress('****@*****.com');
  26. $mail->From = "****@*****.com";
  27. $mail->FromName = "Website Contact Form - " . $name;
  28. $mail->Subject = $subject;
  29.  
  30. $mail->Body = 'This is the HTML message body <b>in bold!</b>';
  31. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  32. $mail->MsgHTML("Name:" . $name . "<br /><br />Email:" . $emailAddr. "<br /><br />Company:" . $company. "<br /><br />Subject:" . $subject. "<br /><br />" . $comment);
  33.  
  34. $message = NULL;
  35. if(!$mail->Send()) {
  36. $message = "Mailer Error: " . $mail->ErrorInfo;
  37. } else {
  38. $message = "Message sent!";
  39. }
  40.  
  41. }
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement