—- plugin —-
description: Sends a campaign to subscribers based on a period since they subscribed
author : Duncan Cameron
lastupdate : 2018-02-11
compatible : phpList 3
sourcerepo : https://github.com/bramley/phplist-plugin-autoresponder
This plugin lets you set up autoresponders - campaigns that are sent to subscribers when a specified period of time has elapsed since they subscribed to a particular list. This is also referred to as “drip-marketing”.
See the README file on the GitHub page https://github.com/bramley/phplist-plugin-autoresponder for how to install and configure the plugin.
If you have just installed the plugin then you will be using version 3 and can ignore this section.
In version 3 of the plugin (released on 10 February 2018) there was a change to the method of selecting subscribers to which an autoresponder should be sent. The change affects the message table, which needs to be updated immediately after upgrading the plugin.
If you upgrade the plugin through phpList on the Manage Plugins page then the message table should be updated automatically. But if you installed and upgraded manually then you will need to change the message table using phpmyadmin or similar tool.
The necessary change is to clear the userselection field on the message table using an update query similar to this
set userselection = null
In version 3 the plugin no longer uses the attribute that was created for each autoresponder by version 2 of the plugin. It is safe to delete any such attribute through the Configure Attributes page in phpList.
In order to control when autoresponder campaigns are actually sent to subscribers it is important to understand a bit about how the plugin works.
The plugin doesn't send any campaigns itself. It simply changes the status of a campaign from either “draft” or “sent” to “submitted” when there is at least one subscriber to whom it should now be sent. The plugin checks for those subscribers with processing that is hooked into the process queue command.
The plugin uses the date/time that a subscriber was added to a list, not the date/time that they were initially added to phpList. This allows an autoresponder to be used for existing subscribers who then join a list, as well as totally new subscribers.
Therefore, most importantly, you need to run the phpList process queue command regularly, either as a cron job (which is recommended) or through the admin page. The frequency at which you run process queue will therefore affect the time interval between a person joining a list and being sent the campaign.
As an example, consider creating an autoresponder for a campaign to be sent one hour after joining a list.
The plugin will change the status of the campaign to “submitted” on the first run of process queue at least one hour after the new subscription. If you have a cron job to run process queue every hour then the time interval between subscribing and the campaign being sent will be at least one hour and could be up to two hours.
To understand that, consider a person subscribing just after the cron job has run. When the cron job next runs it will be just less than one hour since the subscription, therefore the subscriber is not yet ready to be sent the campaign. On the following run of the cron job the subscriber will be ready, but that will be nearly two hours since the subscription.
To have the campaign sent as near to one hour after the subscription you would need to run the cron job more frequently. If it is run every 5 minutes then the time interval would be up to one hour and 5 minutes.
phpList will process any submitted autoresponder campaigns as usual, and those will then eventually change from “submitted” to “sent” status.
The plugin adds an item to the Campaigns menu, Manage autoresponders, through which you can add, amend and delete autoresponders. The page lists existing autoresponders and has a filter through which you can show only those autoresponders for a particular list.
The page shows the number of subscribers who are ready to receive the autoresponder campaign, not yet ready and have already received the campaign.
You first need to create the campaign that you want to send to the subscribers. Create the campaign in full but do not submit it, so it remains at “draft” status.
The list or lists that you choose on the Lists tab will be those that are used by the autoresponder. When someone subscribes to that list they will be sent the campaign after the chosen time period.
On the Schedule tab is a “stop sending after” date, usually six months after the campaign creation date. phpList will not send the campaign after that date, so you might want to change the date to be far in the future if you want the autoresponder to continue indefinitely.
On the Manage Autoresponders page click the Add button to display the form to add an autoresponder.
The form has these fields that need to be entered
The phplist process queue command needs to be run periodically. This allows the plugin to check for subscribers who now need to be sent an autoresponder campaign and to submit that campaign.
The recommended way of running process queue is through a cron job so that it is automated. The frequency of the cron job will depend on the time periods of the configured autoresponders, and how soon after those periods you want the campaign to be sent.
For example, if an autoresponder has a period of 1 day, then running the cron job every hour means that the campaign will be sent within 25 hours of subscribing (not 24 hours). For a new subscription, the campaign will be sent on the next run of the cron job 24 hours after the subscription.
On the manage autoresponders page, you can disable an autoresponder if for any reason you do not want the campaign to be sent.
You can also delete an autoresponder if you do not want to use it any further.
To aid testing an autoresponder by being able to repeatedly add subscribers and process the autoresponder you can reset an autoresponder. Resetting an autoresponder will undo the additions that it has made to the usermessage and listuser table.
It will remove rows from the usermessage table for the autoresponder's campaign, which lets phpList send the campaign again to those subscribers. It will also remove rows from the listuser table for the lists associated with the autoresponder's campaign, which lets you add the same subscribers to the list again.
The fields on an autoresponder can be changed apart from the campaign. If you want to use a different campaign then you should create a new autoresponder.
Please raise any questions or problems in the user forum https://discuss.phplist.org/
See the GitHub page https://github.com/bramley/phplist-plugin-autoresponder