Guest User

Untitled

a guest
Mar 27th, 2018
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <?php
  2.  
  3. use PHPMailer\PHPMailer\PHPMailer;
  4. use PHPMailer\PHPMailer\Exception;
  5.  
  6. require 'C:\xampp\htdocs\vendor\autoload.php';
  7. $mail=new PHPMailer(true);
  8. try
  9. {
  10. $mail->SMTPDebug=1;
  11. $mail->isSMTP();
  12. $mail->Host='smtp.gmail.com';
  13. $mail->SMTPAuth=true;
  14. $mail->Username='phptrial421@gmail.com';
  15. $mail->Password='phptrial';
  16. $mail->SMTPSecure='ssl';
  17. $mail->Port=465;
  18.  
  19. $mail->smtpConnect(
  20. array("ssl"=>array(
  21. "verify_peer"=>false,
  22. "verify_peer_name"=>false,
  23. "allow_self_signed"=>true)));
  24. $mail->setFrom('phptrial421@gmail.com','preet');
  25. $mail->addAddress('kkaul928@gmail.com','mainunahipata');
  26. //$mail->addAttachment('barimage.bmp','new.bmp');
  27. $mail->addCC('dpkbhatta205@gmail.com');
  28. $mail->addBCC('dpkbhatta205@gmail.com');
  29. $mail->isHTML(true);
  30. $mail->Subject='Here is the subject';
  31. $mail->Body='This is the HTML message body<b>in bold!</b>';
  32. $mail->AltBody='This is the body in plain text for non-HTML mail clients';
  33. $mail->send();
  34. echo 'Messagehas been sent';
  35. }
  36. catch(Exception $e)
  37. {
  38. echo 'Message Could not be sent.Mailer Error:',
  39. $mail->ErrorInfo;
  40. }
  41. ?>
Add Comment
Please, Sign In to add comment