1. Home
  2. General info
  3. Process regular campaigns and autoresponders separately

Process regular campaigns and autoresponders separately

By default, mailwizz will process both, regular campaigns and autoresponders in the same time.
This is good for small installations that don’t have multiple campaigns that are sending at once.

If the “Campaigns at once” setting from Backend -> Settings -> Cron is set to 5 for example and you set 5 autoresponders to send this means that the 6th campaign, either regular, either autoresponder won’t trigger anymore because those 5 slots are occupied by those 5 autoresponders.

You can simply increase the number of campaigns at once to alleviate this, but this will only work till certain point.

A better way is to simply split the send-campaigns cron command into two separate commands.
If your cron job for send campaigns is looking like:

* * * * * /usr/bin/php -q /home/domain/public_html/apps/console/console.php send-campaigns >/dev/null 2>&1

Then you can simply edit it like:

* * * * * /usr/bin/php -q /home/domain/public_html/apps/console/console.php send-campaigns --campaigns_type=regular >/dev/null 2>&1

Then add a new cron job for autoresponders:

* * * * * /usr/bin/php -q /home/domain/public_html/apps/console/console.php send-campaigns --campaigns_type=autoresponder >/dev/null 2>&1

What the above does is pretty self explatory, each command will process separately a type of campaigns, that is one will process regular campaigns and one will process autoresponders.

Those commands still depend on the number of “Campaigns at once” set in your Backend -> Settings -> Cron, so if you set 10 campaigns at once, it means the system will process 10 regular campaigns and 10 autoresponders at once.

This can cause issues because again if there are more then 10 autoresponders active at once, it can happen that not all of them can be processed and if you increase the number of Campaigns at once from backend the new limit will also apply to regular campaigns, which might be not what you want.

If that’s the case, the send-campaigns command also accepts a limit parameter so you can explicitly say:

* * * * * /usr/bin/php -q /home/domain/public_html/apps/console/console.php send-campaigns --campaigns_type=autoresponder --campaigns_limit=50 >/dev/null 2>&1

And that means that regardless of your backend settings for campaigns at once, the system will always process 50 autoresponders at once and the backend settings are not taken into consideration anymore.

You can do the same for regular campaigns:

* * * * * /usr/bin/php -q /home/domain/public_html/apps/console/console.php send-campaigns --campaigns_type=regular --campaigns_limit=20 >/dev/null 2>&1

And again the system will process 20 campaigns at once regardless of your backend settings.

To process even more, the send-campaigns command also accepts an offset parameter, so if needed be and there are too many campaigns to process at once, one can simply change the send-campaigns cron jobs like:

* * * * * /usr/bin/php -q /home/domain/public_html/apps/console/console.php send-campaigns --campaigns_type=regular --campaigns_limit=50 --campaigns_offset=0 >/dev/null 2>&1
* * * * * /usr/bin/php -q /home/domain/public_html/apps/console/console.php send-campaigns --campaigns_type=regular --campaigns_limit=50 --campaigns_offset=50 >/dev/null 2>&1
* * * * * /usr/bin/php -q /home/domain/public_html/apps/console/console.php send-campaigns --campaigns_type=regular --campaigns_limit=50 --campaigns_offset=100 >/dev/null 2>&1

What the above does, is to start 3 separate commands to process campaigns in the same time.

The first command will process first 50 campaigns, the second command will jump over first 50 and will process next 50 and the thried will jump over first 100 and process next 50.

Same can be done for autoresponders:

* * * * * /usr/bin/php -q /home/domain/public_html/apps/console/console.php send-campaigns --campaigns_type=autoresponder --campaigns_limit=10 --campaigns_offset=0 >/dev/null 2>&1
* * * * * /usr/bin/php -q /home/domain/public_html/apps/console/console.php send-campaigns --campaigns_type=autoresponder --campaigns_limit=10 --campaigns_offset=10 >/dev/null 2>&1
* * * * * /usr/bin/php -q /home/domain/public_html/apps/console/console.php send-campaigns --campaigns_type=autoresponder --campaigns_limit=10 --campaigns_offset=20 >/dev/null 2>&1

The above examples will use 3 separate commands, but you can literally use as many as you need and as many as your system can cope with, so use these with caution.

Was this article helpful?

Related Articles