Guest User

Untitled

a guest
Oct 31st, 2016
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. <?php
  2. require 'PHPMailerAutoload.php';
  3. require 'class.phpmailer.php';
  4. ?>
  5. <?php
  6. $mail = new PHPMailer;
  7.  
  8. $mail->isSMTP(true); // Set mailer to use SMTP
  9. $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
  10. $mail->SMTPAuth = true; // Enable SMTP authentication
  11. $mail->Username = 'interranetworks.deployment'; // SMTP username
  12. $mail->Password = 'gerladndoma1234!'; // SMTP password
  13. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  14. $mail->Port = 587; // TCP port to connect to
  15.  
  16. $mail->setFrom($_POST['contact_names'], 'Amfani Website');
  17. $mail->addAddress('ooyedele@interranetworks.com', 'Amfani Website'); // Add a recipient
  18. $mail->isHTML(true); // Set email format to HTML
  19.  
  20. $mail->Subject = htmlspecialchars($_POST['contact_subject']);
  21. $mail->Body = '<p>Dear Admin,</p>';
  22. $mail->Body .= '<p> From '.htmlspecialchars($_POST['contact_names']).'</p>';
  23. $mail->Body .= '<p>'.htmlspecialchars($_POST['contact_message']).'</p>';
  24.  
  25. if(isset($_POST['submit'])){
  26. if($mail->send()) {
  27. header( "refresh:5; url=index.php" );
  28. echo "<p class='contact_success_box'>We have received your message and you'll hear from us soon. Thank You!. <br/> You will be redirected after 5 seconds...</p>";
  29. }else{
  30. header( "refresh:5; url=index.php" );
  31. echo "<p class='contact_success_box'>Opps! Something went wrong. Try again. You will be redirected after 5 seconds...</p>";
  32. //echo "Mailer Error: " . $mail->ErrorInfo;
  33. }
  34. }
  35.  
  36. ?>
Add Comment
Please, Sign In to add comment