Advertisement
Guest User

test_phpmailer.php

a guest
Aug 20th, 2018
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. <?php
  2.  
  3. use PHPMailer\PHPMailer\PHPMailer;
  4. use PHPMailer\PHPMailer\Exception;
  5.  
  6. require __DIR__.'/PHPMailer.php';
  7. require __DIR__.'/SMTP.php';
  8. require __DIR__.'/Exception.php';
  9.  
  10. $mail = new PHPMailer();
  11.  
  12. $mail->IsSMTP();
  13. $mail->SMTPAuth = true;
  14. $mail->Host = "lion.asianbookone.com";
  15. $mail->Port = 587;
  16. $mail->Username = "noble";
  17. $mail->Password = "N0b1l*23";
  18. $email_to = "melissayao@comcast.net";
  19.  
  20. $email_subject = "test this out";
  21. $email_message = "test";
  22.  
  23. function died($error) {
  24. echo "We are very sorry, but there were error(s) found with the form you submitted. ";
  25. echo "These errors appear below.<br /><br />";
  26. echo $error."<br /><br />";
  27. echo "Please go back and fix these errors.<br /><br />";
  28. die();
  29. }
  30. // create email headers
  31. $mail->SetFrom('nobleplaces@nobleplaces.com', 'Application Form');
  32. $mail->Subject = $email_subject;
  33. $mail->MsgHTML($email_message);
  34. $mail->AddAddress($email_to, 'Melissa Yao');
  35.  
  36. if ($mail->Send()) {
  37. ?>
  38. <div class="success-mes">
  39. <div class="text-block">Thank you! Your submission has been received! You may now close this window.</div>
  40. </div>
  41. <?php
  42. } else {
  43. ?>
  44.  
  45. <div class="fail-mes">
  46. <div class="text-block">We're sorry! We're currently undergoing server maintenance. Please try again at a later time.</div>
  47. </div>
  48. <?php
  49. }
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement