php - Fire jobs using phpjobscheduler -
i using phpjobscheduler run php script once daily.
i have added phpjobscheduler folder server. says add
<?php include( dirname(__file__) . "/phpjobscheduler/firepjs.php"); ?>
in order fire job. have added index.php
file of application folder, it's not working.
the script run is:
<?php include("dbconfig/db_connection.php"); include('libs/phpmailer-master/phpmailerautoload.php'); $mail = new phpmailer; $mail->smtpdebug = 3; // enable verbose debug output $mail->issmtp(); // set mailer use smtp $mail->host = 'smtp.gmail.com'; // specify main , backup smtp servers //$mail->host = 'smtp.mailgun.org'; $mail->smtpauth = true; // enable smtp authentication $mail->username = 'ex@gmail.com'; // smtp username $mail->password = 'pass'; // smtp password $mail->smtpsecure = 'tls'; // enable tls encryption, `ssl` accepted $mail->port = 25; // tcp port connect $pending = array( "select * user status='processing' , reason!='out of island'", "select * user status='processing' , reason!='out of island'", //dgm-hr "select * user status='new'", //dgm-itas "select * user status='processing' , reason='out of island'", //manager-hr "select * user crm_status='pending'", //crm-eng "select * user oss_status='pending'", //oss-eng "select * user bss_status='pending'" //bss-eng ); $result = mysqli_query($dbcon,$pending[0]); $result1 = mysqli_query($dbcon,$pending[1]); $result2 = mysqli_query($dbcon,$pending[2]); $result3 = mysqli_query($dbcon,$pending[3]); $result4 = mysqli_query($dbcon,$pending[4]); $result5 = mysqli_query($dbcon,$pending[5]); $result6 = mysqli_query($dbcon,$pending[6]); $address=array('ex@gmail.com','ex@gmail.com','ex@gmail.com','ex@gmail.com','ex@gmail.com','ex@gmail.com','ex@gmail.com'); if(!$result||!$result1||!$result2||!$result3||!$result4||!$result5||!$result6) { die('could not data: ' . mysqli_error()); } else { $count= mysqli_num_rows($result); $count1= mysqli_num_rows($result1); $count2= mysqli_num_rows($result2); $count3= mysqli_num_rows($result3); $count4= mysqli_num_rows($result4); $count5= mysqli_num_rows($result5); $count6= mysqli_num_rows($result6); $count_c=array($count,$count1,$count2,$count3,$count4,$count5,$count6); //$mail_id=implode(" ",$address); ($i = 0; $i < 7; $i++) { $mail->setfrom('ex@gmail.com', 'mailer'); $mail->addaddress($address[$i], 'mailer'); $mail->subject = 'notification: user management system'; $mail->body = 'dear user, <br> <br>you have '.$count_c[$i].' records pending approval.<br> please engage relevant tasks.<br><br>'; $mail->altbody = 'this body in plain text non-html mail clients'; if(!$mail->send()) { echo 'message not sent.'; echo 'mailer error: ' . $mail->errorinfo; } else { echo 'message has been sent'; } } ?>
do need modify code?
Comments
Post a Comment