Ever thought of a scenario in which you need to send regular daily, weekly, monthly updates via email. In this tutorial I’ll show how you can accomplish this automation and send recurring email using Mautic.
- Create a custom field to assign a sending frequency for the contact.
- Create Email you would like to send.
- Create campaign with “Allow contacts to restart campaign” set to Yes.
- At the end of campaign workflow, re-enroll contact to same campaign with a certain delay.
Custom Field and decision on the frequency of recurrence
In this section let me give an overview of how to set the base and what are the parameters used in the process.
Example Use case Scenario
It can be as simple as sending dynamically generated newsletter or as complicated as price subscription of some commodity. In my case it was later. A customer required users to sign up for price update of a specific commodity. And user can decide if they want daily, weekly, bi-weekly or monthly update on the price.
My use case may sound complicated but, if you reached this tutorial looking for sending simple recurring email it’ll also be okay.
Why use custom field ?
Depending on the use case scenario, which in my case was, Daily, weekly, Bi-weekly and monthly subscription. I used a custom field to decide how often this contact/user wants to receive the email.
There is another way, which could be segmenting the customer in different segments based on their preference but then the issue would be to create 4 segments and each time user changes the subscription preference the segment would need changing either using a campaign or form action [By the way, I have this tutorial describing how many ways there are in mautic to change contact segment].
So to avoid this hassle I create a simple select type custom field and i call it “subscription interval”. I’ll be storing the user preference in this field.
What is an alternative ?
The alternative to custom field method is to create segments for each kind of subscription. You can create multiple segments based on user preferences. So, for example if you choose to go for segmentation, you will need to create 4 segments for each type of subscription so you can categorize daily, weekly, bi-weekly and monthly subscribers.
The problem with this method is that it’ll work but you’ll need to create 4 segments and 4 campaigns. Though its easy to create segments and campaigns in the Mautic but it’ll be less clean.
I was originally using this method but recently updated my own recurring email campaign to custom field method and single segment and single campaign.
Creating the Email for Recurring Email Campaign
To create email for sending recurring email campaign is not a big deal, it is usually similar to how you would create another kind of emails. However in my case there was only minor different that, the content was coming from an outside API. How did I manage it ?
- Create another custom field which could host the incoming data from integrated application or 3rd party API.
- Use Mautic API [To know more about Mautic API and Authentication read this tutorial] to fill in the value in this field.
- Use the custom field in the email like any other contact parameter.
- This field will be filled by either mautic api for any contact or using a custom plugin in Mautic.
If your email doesn’t require any external or calculated data, then you can directly move on to create the email and jump to creating campaign.
Creating Recurring Email Campaign
Okay to create a campaign which could send email on its own based on user preferences you need to create regular campaign but enable the “Allow contacts to restart the campaign”. So following are the steps.
Create and Configure Campaign
- Create new campaign.
- Fill in the details.
- Set “Allow contact to restart campaign” to “YES”.
- Enter the campaign builder and start adding nodes as shown in next set of steps.
Campaign Builder and Enabling Recurrence
- Start with the source selection and set your segment as the source of the campaign.
- Add the condition node as child to segment node, in this one I am checking the pending opt in status for this contact.
- Then add the “Send Email” action to the positive node of condition node[this may vary based on if your outcome is positive or negative based on how you check the condition].
- So, email is not sent to the contact for the first time when enrolled in the campaign. Next step is to ensure this email can be sent again from this same campaign. For this now Add another condition Node.
- In this node you’ll need to check your custom field which is being used for the subscription frequency check.
- So the action you need to take after this will be “Change Contact Segment”. But there’s a catch. Instead of using “Execute this event: immediately” you need to select “at a relative time period”.
- As you can see in the screenshot, there is 1 day delay relative to last event, and I marked weekdays as I don’t want to send email over the weekend.
- in the Campaign selection i have selected the same campaign and because the campaign setting was set to “allow contact to restart campaign” the contact will be re-enrolled in this campaign and same process will start over.
- Final structure of the campaign looks like image below.
As you can see in the image, I have set the delays based on daily, weekly, bi-weekly and monthly subscription check. This is example from my own campaign however I created a simpler version as a proof of operation which has less nodes and delay is also 10 minutes so i can verify that it works. Checkout the next section for working proof and very simple example.
Working Example or Recurring Email Campaign
As I mentioned the image above is from a live campaign itself however I am showing another very simple example as a proof. However my emails are 20 minutes apart because of cron job configuration but as an example i have multiple emails in my inbox to show it will keep on working until you turn it off.
This is how it looks in my inbox, please note because of campaign cron and email cron jobs the time goes upto 20 minutes between each email, but the point is it work absolutely well.