Advertisement
Guest User

Untitled

a guest
May 23rd, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.48 KB | None | 0 0
  1. <?php
  2. $servername = "****";
  3. $username = "*****";
  4. $password = "****";
  5. $dbname = "****";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error) {
  11.     die("Connection failed: " . $conn->connect_error);
  12. }
  13. $sql = "SELECT name, COUNT(current_task_id) FROM apps_progress WHERE current_task_id = 3 GROUP BY name LIMIT 0, 30 ";
  14. $result = $conn->query($sql);
  15. if ($result->num_rows > 0) {
  16.  
  17. include('PHPMailer-master/class.phpmailer.php');
  18. $mail = new PHPMailer();
  19. //$mail->IsSMTP(); // telling the class to use SMTP
  20. //$mail->Host = "localhost"; // SMTP server
  21. //IsSMTP(); // send via SMTP
  22. $mail->Host     = "*********"; // SMTP server Gmail
  23. $mail->port = 143;
  24. $mail->SMTPAuth = true; // turn on SMTP authentication
  25.  
  26. $mail->Username = "**********"; //
  27. $mail->Password = "********"; // SMTP password
  28. $webmaster_email = "************"; //Reply to this email ID
  29. $email = "fredysetiawan1992@gmail.com"; // Recipients email ID
  30. $name = "namapenerima"; // Recipient's name
  31. $mail->From = $webmaster_email;
  32. $mail->FromName = "fredy";
  33. $mail->AddAddress($email,$name);
  34. $mail->AddReplyTo($webmaster_email,"paidi");
  35. $mail->IsHTML(true); // send as HTML
  36. $mail->Subject = "Ini adalah Email HTML";
  37. $mail->Body = "<p>jumlahnya "echo $row[1]"</p> "; //HTML Body
  38. if(!$mail->Send())
  39. {
  40. echo "Mailer Error: " . $mail->ErrorInfo;
  41. }
  42. else
  43. {
  44. echo "Message has been sent";
  45. }
  46. }
  47. } else {
  48.     echo "0 results";
  49. }
  50. $conn->close();
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement