Jump to content
Sign in to follow this  
Blesta Addons

Limit emails sent in mass mailer plugin

Recommended Posts

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...