Blesta Addons Posted May 14, 2020 Report Posted May 14, 2020 some of our clients asked us to change the mass mailer plugin to limit the emails sent on the cron, as the actual one some times block the smtp or the hosting account if the list is a big one. so we have decided to look in the code and i have found a simple way to do the jobs, and since is simple we have decided to share it with the community . open the file plugins/mass_mailer/Cron/Email.php and change this lines (begin from line 55) while (($task = $this->MassMailerTasks->getByJob($job->id))) { // Send the email $this->MassMailerEmails->send($task, $email); // Delete the task $this->MassMailerTasks->delete($task->id); } $this->completeJob($job->id); by this one $counter = 0; $limit = 15; while (($task = $this->MassMailerTasks->getByJob($job->id))) { if ($counter > $limit) { break; } // Send the email $this->MassMailerEmails->send($task, $email); // Delete the task $this->MassMailerTasks->delete($task->id); $counter += 1; } if (!$task) { $this->completeJob($job->id); } you can set you limit by editing the var $limit, in our example every cron (5min) it well send only 15 emails. i hope if Blesta staff can look into this simple task and add a limit to the mailer pluginĀ via the plugin setting. Jono and cluster 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.