Tutorial: How To Set Up Mautic, a Free Open Source Email Marketing Software - Medium

You can now send test emails, upload lists, and even send newsletters. But what you can't do is automate email sending via email sequences or schedule newsletters. Sending at this point is all manual.
To enable automated email sending or scheduled newsletters you need to configure Cron Jobs.
Cron Jobs essentially enables Mautic to send scheduled emails or emails that are set to be sent after specific triggers in an email sequence. For this reason, they are configured in your Cpanel where they can locate the Mautic installation and automate tasks.
Mautic has a guide on Cron Jobs. If it's your first time handling Cron Jobs, it can feel a little bit overwhelming. Not to worry though — I am here to guide you.
From Mautic, there are three required Cron Jobs to automate ordinary day to day tasks. There are also other optional Cron Jobs to automate more advanced tasks. In our case, we will pick the three required Cron Jobs and probably one or two of the optional Cron Jobs that we think are necessary.
The general structure of a Cron Job
Let us look at each one of these in more detail.
Time
How often a Cron Job should run — it can be configured in minutes, hours, days, and months. From the above time example, the Cron Job will run at 0 minutes, 15 minutes, 30 minutes, and 45 minutes respectively within an hour.
PHP path
All Cron Jobs must be set via a PHP path. Hosting providers share this path on the Cron Job page inside the Cpanel.
To check the path, login to your Cpanel, go to Advanced then click Cron Jobs. Image below. You will be able to see your PHP path.
In my case, the PHP path is /usr/local/bin/php.
Path to your bin folder on your Mautic installation
The path to your bin folder simply tells the Cron Job where it should run.
On your Cpanel head over to File Manager. Find the subdomain you used to install Mautic and click it. You will see all the files of your Mautic installation. Find the bin folder and click it.
At this juncture, you are already on this path on the back end. All you need to do is note the path and include it on your Cron Job. To do this, right-click the Console file then click Edit.
You will receive a prompt to proceed with editing, agree to the prompt.
We will not edit anything, all we want is the path to the bin folder. After agreeing to the prompt the path to the bin folder will be on the top left corner where you can copy it and use it to build the Cron job. Image below.
Copy it and paste it into a word document or text file where you can build your Cron Job.
Mine looks something like this.
/home/clembrian/convert.clementbrian.com/bin/console Since all Cron Jobs start with the console path already in place, we will have to delete the word console. The clean path to the bin folder on Mautic should look something like this.
/home/clembrian/convert.clementbrian.com/bin/ Specific Cron Jobs
Below are Cron Jobs as they appear on the Mautic Cron Job guide.
Required Cron Jobs
- To keep the segments updated
php /path/to/mautic/bin/console mautic:segments:update 2. To keep campaigns updated with applicable contacts
php /path/to/mautic/bin/console mautic:campaigns:update 3. To execute campaign events
php /path/to/mautic/bin/console mautic:campaigns:trigger Optional Cron Jobs that we will use
4. To process email queue/send emails
php /path/to/mautic/bin/console mautic:emails:send 5. IP lookup Cron Job, to look up contacts IP
php /path/to/mautic/bin/console mautic:iplookup:download There are other optional Cron Jobs. I personally chose to use only those two. Depending on your preference you might want to add more optional Cron Jobs. With those two I was already satisfied. Everything functioned as I wanted.
Complete Cron Job
Below is how your complete Cron Job should look like.
(Time) PHP path + Path to your bin folder + Specific Cron Job
(0,15,30,45) /usr/local/bin/php /home/clembrian/convert.clementbrian.com/bin/console mautic:segments:update
You will configure time manually before pasting the Cron Job on your Cpanel. The Cron Job to paste should adopt the structure below.
From the above Cron Job screenshot — I have marked the PHP path, path to bin folder on Mautic, and the specific Cron Job. Each Cron Job you paste on your Cpanel should have all three elements.
You should also note there is a space between the PHP path and path to the bin folder on Mautic. Failure to include the space means the Cron Job will note work. A cleaner image below showing the space.
Important — you should add >/dev/null 2>&1 at the end of each Cron Job. What this does is prevent the sending of notifications each time a Cron Job runs. You don't want to be spammed by Cron Job notifications as they run every five minutes. You should also remember to put a space before adding the above function.
Below is a screenshot example of all the Cron Jobs I used and the time I picked each to run.
You should prepare a word document with all the Cron Jobs you intend to use before you start to add them to your Cpanel. Just like in the above screenshot.
Comments
Post a Comment