Advertisement
Guest User

Untitled

a guest
Jul 21st, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.73 KB | None | 0 0
  1. $mail = new PHPMailer;
  2.  
  3. $mail->isSMTP(); // Set mailer to use SMTP
  4. $mail->Host = '******'; // Specify main and backup SMTP servers
  5. $mail->SMTPAuth = true; // Enable SMTP authentication
  6. $mail->Username = '******'; // SMTP username
  7. $mail->Password = '******'; // SMTP password
  8. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  9. $mail->Port = 587;
  10. $mail->CharSet = 'UTF-8';
  11. $mail->setFrom('******', '******');
  12.  
  13. $checkUptimeList = UptimeQuery::create()->find();
  14.  
  15. foreach($checkUptimeList as $domain){
  16.  
  17. $domainId = $domain->getId();
  18. $host = $domain->getDomain();
  19. $response = get_web_page($host);
  20.  
  21.  
  22. if($response == 'true') {
  23. $bol = 1;
  24. if($domain->getSendEmail() == 1){
  25. if($domain->getLive() != $bol){
  26. $user = UsersQuery::create()->findOneByUserID($domain->getUserOweID());
  27.  
  28. $mail->addAddress($user->getUserEmail(), $user->getFullName()); // Add a recipient
  29.  
  30. $mail->isHTML(true); // Set email format to HTML
  31.  
  32. $mail->Subject = 'test';
  33. $mail->Body = 'test';
  34.  
  35. if(!$mail->send()) {
  36. echo 'Message could not be sent.';
  37. echo 'Mailer Error: ' . $mail->ErrorInfo;
  38. }
  39.  
  40. }
  41. }
  42. $updateDomain = UptimeQuery::create()->filterByUserOweId($domain->getUserOweID())->findOneByID($domainId);
  43. $updateDomain->setLive(1);
  44. $updateDomain->save();
  45.  
  46. } else {
  47.  
  48. $domainId = $domain->getId();
  49. $host = $domain->getDomain();
  50. $response = get_web_page($host);
  51. $bol = 0;
  52. if($domain->getSendEmail() == 1){
  53. if($domain->getLive() != $bol){
  54. $user = UsersQuery::create()->findOneByUserID($domain->getUserOweID());
  55.  
  56. $mail->addAddress($user->getUserEmail(), $user->getFullName()); // Add a recipient
  57.  
  58. $mail->isHTML(true); // Set email format to HTML
  59.  
  60. $mail->Subject = 'test';
  61. $mail->Body = 'test';
  62.  
  63. if(!$mail->send()) {
  64. echo 'Message could not be sent.';
  65. echo 'Mailer Error: ' . $mail->ErrorInfo;
  66. }
  67.  
  68.  
  69. }
  70. }
  71. $updateDomain = UptimeQuery::create()->filterByUserOweId($domain->getUserOweID())->findOneByID($domain->getId());
  72. $updateDomain->setLive(0);
  73. $updateDomain->save();
  74. }
  75.  
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement