dimoss
Well-Known Member
Hi,
it has been reported in the past: https://fabrikar.com/forums/index.php?threads/problem-fabrik-scheduled-tasks.54184/ by @bonghetti
I encounter the same problem with php plugin enabled and the code directly in the PHP code section as below:
Require querystring is set to YES with a secret word. I tried with wget from my server and from webcron.org. Doesnt work from both. No email send and no log is recorded on #__fabrik_log. Time frequency tested with 1 muinute and 1 hour but nothing changed.
If I run it from the backend clicking the run button it works as expected and send the emails correctly.
I have latest Fabrik and Joomla version and PHP 8.1.x
Any idea is very much welcome.
Thanks.
it has been reported in the past: https://fabrikar.com/forums/index.php?threads/problem-fabrik-scheduled-tasks.54184/ by @bonghetti
I encounter the same problem with php plugin enabled and the code directly in the PHP code section as below:
PHP:
use Joomla\CMS\Factory;
$db = \Joomla\CMS\Factory::getContainer()->get('DatabaseDriver');
$config = Factory::getConfig();
$queryString = "SELECT GROUP_CONCAT(CONCAT(name, ' - #', player_id) ORDER BY name ASC SEPARATOR '\n') AS combined_name, assoc, email FROM vw_expired_passports WHERE assoc REGEXP '^[M-Z]' GROUP by assoc";
$db->setQuery($queryString);
$rows = $db->loadAssocList();
$successCount = 0;
$failureCount = 0;
foreach ($rows as $row) {
$playerName = $row['combined_name'];
$playerAssoc = $row['assoc'];
$playerEmail = $row['email'];
$to = $playerEmail;
$subject = "xxx";
$msg = "xxx"";
$res = FabrikWorker::sendMail(
$config->get('mailfrom'),
$config->get('fromname'),
$to,
$subject,
$msg
);
if ($res) {
$successCount++;
} else {
$failureCount++;
}
}
// Send email notification
$notificationSubject = "xxx";
$notificationMessage = "Emails sent successfully: $successCount\nEmails failed: $failureCount";
$notificationRes = FabrikWorker::sendMail(
$config->get('mailfrom'),
$config->get('fromname'),
"xxx@xxx.com", // Specify your email address here
$notificationSubject,
$notificationMessage
);
if ($notificationRes) {
echo "Notification email sent successfully.<br>";
} else {
echo "Failed to send notification email.<br>";
}
Require querystring is set to YES with a secret word. I tried with wget from my server and from webcron.org. Doesnt work from both. No email send and no log is recorded on #__fabrik_log. Time frequency tested with 1 muinute and 1 hour but nothing changed.
If I run it from the backend clicking the run button it works as expected and send the emails correctly.
I have latest Fabrik and Joomla version and PHP 8.1.x
Any idea is very much welcome.
Thanks.