Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. <?php
  2. use PHPMailer\PHPMailer\PHPMailer;
  3. require 'autoload.php';
  4. $mail = new PHPMailer;
  5. $mail->isSMTP();
  6. $mail->SMTPDebug = 2;
  7.  
  8. $mail->Host = 'smtp.gmail.com';
  9. $mail->Port = 465;
  10. $mail->SMTPAuth = true;
  11. $mail->SMTPSecure = 'ssl';
  12. $mail->Username = 'you@gmail.com';
  13. $mail->Password = 'Yourpassword';
  14.  
  15. $mail->setFrom('you@gmail.com', '');
  16. $mail->addReplyTo('you@gmail.com', '');
  17. $mail->addAddress('recipient@gmail.com', '');
  18. $mail->Subject = 'This means that emails work fine.';
  19. $mail->msgHTML("<h1>Incoming message to Houston</h1>");
  20.  
  21. if (!$mail->send()) {
  22. echo 'error: ' . $mail->ErrorInfo;
  23. } else {
  24. echo 'message sent';
  25. }
  26. //if (!$mail->send()) {
  27. // echo $message_error . $mail->ErrorInfo;
  28. //} else {
  29. // echo $message_send;
  30. //}
  31.  
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement