I am running a loop script in PHP command line, which send out emails to customers using PHPMailer. The problem I am receiving is that the command line script exits when the PHPMailer returns a false.
Here is the script pseudocode:
while(the loop is valid){
if(mail ID exists){
set_time_limit(30);
..compose mail..
if($mail->Send()){
..Mark as success in database..
usleep(10000);
} else {
..Mark as failure in database..
usleep(10000);
}
}
..continue loop..
}
If the $mail->Send() returns a false, the script stops and exits. Is this an expected behaviour of PHP in command line? If that’s the case, is there any way to tell PHP not to stop when it receives a false?
Thank you for any help.
I would guess that the
$mail->Send()function (or something else completely) is throwing an error which is halting the execution of your script.I take it the values are not getting updated in the database either? This will be the case if so. Run the script with error reporting on to determine this.