Closed
Description
I have written the events with schedule to run every hour But it throw error
TypeError: Cannot assign true to property CodeIgniter\Tasks\TaskLog::$output of type ?string
public static function sent_unqueue_mail()
{
$repo = new SQLEmail_listRepository();
$data = $repo->getUnQueueJobs();
$totalJob = 0;
if (is_array($data) && count($data)) {
$eLib = new \Mail\Libraries\Email();
foreach ($data as $k => $v) {
try {
$eLib->send($v);
$totalJob++;
} catch (\Exception $e) {
log_message('error', "Failed to send email for job $k: " . $e->getMessage());
}
}
}
log_message('info', "Sent Unqueue Completed $totalJob");
return ["Sent Unqueue Completed"];
}
I assigned events
Events::on('sent_unqueue_mail', '\Mail\Events\EventsMail::sent_unqueue_mail');
please help me to resolve this issues