Advertisement
Guest User

Untitled

a guest
Mar 27th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2.  
  3. function __construct(){
  4. $dbCon = mysqli_connect("localhost", "root", "", "dbppa");
  5. }
  6.  
  7.  
  8.  
  9. public function sendMail($e,$message,$subject){
  10. $mail = new PhpMailer;
  11.  
  12. $body = $message;
  13.  
  14. $subject = "PPA Newsletter";
  15. $clientName = $e;
  16. $mail->SMTPDebug = 2;
  17. $mail->CharSet = 'utf-8';
  18. $mail->isSMTP();
  19. $mail->SMTPAuth = true;
  20. $mail->Host = 'tls://smtp.gmail.com:587';
  21. $mail->Port = 587;
  22. $mail->Username = "myemail@mail.com";
  23. $mail->Password = "password";
  24. $mail->SMTPSecure = 'tls';
  25. $mail->setFrom("myemail@mail.com","PPA Administrator");
  26. $mail->addReplyTo('myemail@mail.com', 'PPA Admin');
  27. $mail->Subject = $subject;
  28. $mail->AltBody = "This is the official news letter from PPA ";
  29. $mail->Body = $body;
  30. $address = $e;
  31. $mail->AddAddress($address, $clientName);
  32.  
  33. if(!$mail->Send()){
  34. echo "NOT SENT";
  35.  
  36. }
  37. else{
  38. echo "SENT";
  39.  
  40.  
  41. }
  42.  
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement