Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $mail = new PHPMailer;
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = '******'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = '******'; // SMTP username
- $mail->Password = '******'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 587;
- $mail->CharSet = 'UTF-8';
- $mail->setFrom('******', '******');
- $checkUptimeList = UptimeQuery::create()->find();
- foreach($checkUptimeList as $domain){
- $domainId = $domain->getId();
- $host = $domain->getDomain();
- $response = get_web_page($host);
- if($response == 'true') {
- $bol = 1;
- if($domain->getSendEmail() == 1){
- if($domain->getLive() != $bol){
- $user = UsersQuery::create()->findOneByUserID($domain->getUserOweID());
- $mail->addAddress($user->getUserEmail(), $user->getFullName()); // Add a recipient
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = 'test';
- $mail->Body = 'test';
- if(!$mail->send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- }
- }
- }
- $updateDomain = UptimeQuery::create()->filterByUserOweId($domain->getUserOweID())->findOneByID($domainId);
- $updateDomain->setLive(1);
- $updateDomain->save();
- } else {
- $domainId = $domain->getId();
- $host = $domain->getDomain();
- $response = get_web_page($host);
- $bol = 0;
- if($domain->getSendEmail() == 1){
- if($domain->getLive() != $bol){
- $user = UsersQuery::create()->findOneByUserID($domain->getUserOweID());
- $mail->addAddress($user->getUserEmail(), $user->getFullName()); // Add a recipient
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = 'test';
- $mail->Body = 'test';
- if(!$mail->send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- }
- }
- }
- $updateDomain = UptimeQuery::create()->filterByUserOweId($domain->getUserOweID())->findOneByID($domain->getId());
- $updateDomain->setLive(0);
- $updateDomain->save();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement