Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. <?php
  2. // Import PHPMailer classes into the global namespace
  3. // These must be at the top of your script, not inside a function
  4. use PHPMailer\PHPMailer\PHPMailer;
  5. use PHPMailer\PHPMailer\Exception;
  6. use PHPMailer\PHPMailer\SMTP;
  7. use PHPMailer\PHPMailer\POP3;
  8.  
  9. require 'vendor/autoload.php';
  10.  
  11. // require 'src/Exception.php'
  12. // require 'src/PHPMailer.php';
  13. // require 'src/SMTP.php';
  14. // require 'src/POP3.php';
  15.  
  16.  
  17. $mail = new PHPMailer(true); // Passing `true` enables exceptions
  18.  
  19. //Server settings
  20. $mail->SMTPDebug = 2; // Enable verbose debug output
  21. $mail->isSMTP(); // Set mailer to use SMTP
  22. $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
  23. $mail->SMTPAuth = true; // Enable SMTP authentication
  24. $mail->Username = 'testbaokhoa@gmail.com'; // SMTP username
  25. $mail->Password = 'test123test123'; // SMTP password
  26. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  27. $mail->Port = 587; // TCP port to connect to
  28.  
  29. //Recipients
  30. $mail->email_from('info@homerateloan.com', 'Mailer'); // Add a recipient
  31. $mail->email_address('tealkrysta92@gmail.com'); // Name is optional
  32.  
  33. //Content
  34. $mail->isHTML(true); // Set email format to HTML
  35. $mail->Subject = 'HomeRateLoan website customer';
  36. $mail->Body = '<p>Customer from HomeRateLoan</p>' . "\n" .
  37. '<p>Name: ' . $_POST['name'] . '</p>' . "\n" .
  38. '<p>State: ' . $_POST['state'] . '</p>' . "\n" .
  39. '<p>Rent Type: ' . $_POST['renttype'] . '</p>' . "\n" .
  40. '<p>Property Type: ' . $_POST['proptype'] . '</p>' . "\n" .
  41. '<p>Required Money: ' . $_POST['reqmoney'] . '</p>' . "\n" .
  42. '<p>Zip: ' . $_POST['propzip'] . '</p>' . "\n" .
  43. '<p>Credit: ' . $_POST['credit'] . '</p>' . "\n" .
  44. '<p>Email: ' . $_POST['email'] . '</p>' . "\n" .
  45. '<p>Phone: ' . $_POST['phone'] . '</p>' . "\n";
  46. // $mail->Body = 'This is the HTML message body <b>in bold!</b>';
  47. // $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  48.  
  49.  
  50. if($mail->send()){
  51. echo 'Message has been sent';
  52. } else {
  53. error_reporting(E_ALL); ini_set('display_errors', 1);
  54. }
  55.  
  56.  
  57.  
  58. // echo 'Message has been sent';
  59. // } catch (Exception $e) {
  60. // header('Content-Type: application/json');
  61. // error_reporting(E_ALL); ini_set('display_errors', 1);
  62. // echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
  63. // echo json_encode($vals, JSON_PRETTY_PRINT);
  64. // exit;
  65. // }
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement