Guest User

Untitled

a guest
Oct 1st, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. require_once(__DIR__ . '/PHPMailer/src/Exception.php');
  2. require_once(__DIR__ . '/PHPMailer/src/PHPMailer.php');
  3. require_once(__DIR__ . '/PHPMailer/src/SMTP.php');
  4. $mail = new PHPMailerPHPMailerPHPMailer(true);
  5. try {
  6. $mail->SMTPDebug = 2;
  7. $mail->isSMTP();
  8. $mail->Host = 'smtp.gmail.com';
  9. $mail->SMTPAuth = true;
  10. $mail->Username = '**********@gmail.com';
  11. $mail->Password = '**********';
  12. $mail->SMTPSecure = 'ssl';
  13. $mail->Port = 587;
  14.  
  15. //Recipients
  16. $mail->setFrom('**********@yahoo.com', 'Mailer');
  17. $mail->addAddress('**********@gmail.com', 'Joe User');
  18. $mail->addReplyTo('**********@gmail.com', 'Information');
  19.  
  20. //Content
  21. $mail->isHTML(true);
  22. $mail->Subject = 'Here is the subject';
  23. $mail->Body = 'This is the HTML message body <b>in bold!</b>';
  24. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  25.  
  26. $mail->send();
  27. echo 'Message has been sent';
  28. } catch (Exception $e) {
  29. echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
  30. }
  31. }
Add Comment
Please, Sign In to add comment