1. Home
  2. Docs
  3. Mailster
  4. Cronjob Configuration
  5. Dedicated Cronjobs

Dedicated Cronjobs

This type of cron jobs has the advantage that they do not cause page load delays for site users at all.

Dedicated cron jobs are only available in Mailster Business and Mailster Ultimate.
To use it, you will have to change the “Trigger Source” for Mailster accordingly. The setting can be changed here:

  • Navigate in Joomla’s backend to the Plugin Manager (Plugins > Extensions)
  • Find the system plugin “Mailster Email Forwarder” (Note: this is not the content plugin “Mailster Subscriber”)
  • Search for the setting “Trigger Source“:
  • Change the setting to “Dedicated cron jobs only“:

You may also want to increase the “Max. execution time” setting; recommended is half of your PHP max. execution time.

Prepare your PHP cron file

In order to build the cron job, go to the directory [joomla]/components/com_mailster/extras and copy the file cronjob_mailster.php to a folder on the server executing the cron job.

It is important that you copy it to a different location before you go any further.
Otherwise, the file is overwritten during the installation of an update for Mailster.

Then open it in a text editor. It should look as follows:

You will need to modify the URL (as described in the file).
The other options (debug and the enforcement of the “file_get_contents” method) do not need to be changed in most cases.

Change the URL https://www.example.com to the URL where your Mailster installation is running.
Do not forget to add the whole path of your Joomla installation – if you installed it in a “cms” subdirectory, you also have to add that (e.g. https://www.example.com/cms/index.php?option=com_mailster&controller=cron&task=all&key=secret).

Now let’s take a closer look at the URL parts.

Dedicated cron jobs work with special URLs, one example:

https://example.com/index.php?option=com_mailster&controller=cron&task=all&key=secret 

The meaning of the parameters is explained in the new section.

URL Parameters

  • option=com_mailster and controller=cron: the general call of Mailster’s dedicated cron job mode
  • task=all: call the “all” cron job tasks, more on the different tasks below
  • key=secret: this key has to be the same as the cron job key you provided in Mailster’s configuration:

Use only lower- and/or upper-case alphanumeric characters (0-9, a-z, A-Z) in your cron job key.
Other characters may need to be manually URL-encoded. This is error-prone and can cause the Mailster actions to never start.

Working with the all task is the recommended dedicated cron job setting and suitable for most setups.
However, there are more tasks available for dedicated cron jobs:

  • all: sends and retrieves emails for all mailing lists.
    Recommended in most cases, but not recommended for big mailing lists or high traffic lists.
  • fetchall: retrieves emails of the mailboxes of all active mailing lists
  • fetch: retrieves the emails of the mailbox of one mailing list the emails in the mailbox.
    You have to provide the mailing list to use with the “id” parameter (e.g. &id=1)
  • send: sends out mails in the send queue

While the task all is suitable for most cases, we recommend using multiple cron jobs (e.g. one with the task fetchall and one with the send task) for big mailing lists (more than 100 recipients) or high traffic lists.

Further examples:

Retrieve and send in one run, the cron job key was set to “secret”:

https://example.com/index.php?option=com_mailster&controller=cron&task=all&key=secret

Retrieve emails for all active mailing lists:

https://example.com/index.php?option=com_mailster&controller=cron&task=fetchall&key=secret

Retrieve emails for mailing list with ID 3:

https://example.com/index.php?option=com_mailster&controller=cron&task=fetch&id=3&key=secret

Work on emails in send queue:

https://example.com/index.php?option=com_mailster&controller=cron&task=send&key=secret

Debug Mode

To check whether the cron job is successfully executed, you can copy the cron job URL into the browser and append this: &debug=true
Example (with the debug mode active):

https://example.com/index.php?option=com_mailster&controller=cron&task=all&id=1&key=secret&debug=true

You should get an output like the following:

Adding the debug URL parameter is done by the cronjob_mailster.php script, when the debug flag is set to true.

Finishing up

Let’s get back to our cron job file and what we need to do with it.

  • Change the URL in the cronjob_mailster.php file by replacing the URL between the quotes: $url = “[…]“.
    Again: in most cases, the all task is suitable and should be used.
  • You can leave the debug flag active ($debug = true;) in order to see whether the cron job works.
    If you really want to, you can turn it off later ($debug = false;).
  • Save your changes to the cron job file
  • Now setup the cron on your server.