Advertisement
Guest User

Untitled

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