Guest User

phpemail

a guest
May 5th, 2018
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. <?php
  2. use PHPMailer\PHPMailer\PHPMailer;
  3. use PHPMailer\PHPMailer\Exception;
  4. //Load composer's autoloader
  5. require 'C:\wamp64\www\vendor\autoload.php';
  6. $mail= new PHPMailer(true);
  7. try
  8. {
  9. $mail->SMTPDebug=1;
  10. $mail->isSMTP();
  11. $mail->Host='smtp.gmail.com';
  12. $mail->SMTPAuth=true;
  13. $mail->Username='phptestmca2017@gmail.com';
  14. $mail->Password='lpupunjab123';
  15. $mail->SMTPSecure='ssl';
  16. $mail->Port='465';
  17. $mail->smtpConnect(
  18. array(
  19. "ssl"=>array(
  20. "verify_peer"=>false,
  21. "verify_peer_name"=>false,
  22. "allow_self_signed"=>true
  23. )
  24. )
  25. );
  26.  
  27. //Recipients
  28.  
  29. $mail->setFrom('phptestmca2017@gmail.com','MCA D1711 PHP');
  30. $mail->addAddress('kkaul928@gmail.com','Deepak Bhatta Kaji');
  31. $mail->addAttachment('E:\Zzzz Misc 2018\LOGO MIssion to LPU.png');
  32. $mail->addCC('gchirag09@gmail.com');
  33. $mail->addBCC('kkaul928@gmail.com');
  34. $mail->isHTML(true);
  35. $mail->Subject='Our Project Logo';
  36. $mail->Body='Hi Maam <br> This is our Game Logo <b>Mission To LPU</b>';
  37. $mail->AltBody='This is Body in Plain Text for Non-HTML MAil Clients';
  38. $mail->send();
  39.  
  40. echo 'Message Has Been Sent';
  41. }
  42. catch(Exception $e)
  43. {
  44. echo 'Message Couldnot be Sent. Mailer Error:',$mail->ErrorInfo;
  45. }
  46.  
  47. ?>
Add Comment
Please, Sign In to add comment