larger smaller normal text version of this page
Phplist Documentation » Message functions »

Repetition



Explanation of repetition feature


PHPlist can automatically re-schedule your messages after sending it. It will create an exact copy of your message. This can be used to work in conjunction with file system attachments. If you want PHPlist to send you some file from the server at a regular interval, the filesystem attachment will be refreshed at the moment of sending the (first) message.

You can enable the repetition feature in your config.php file:

# Repetition. This adds the option to repeat the same message in the future.
# After the message has been sent, this option will cause the system to automatically
# create a new message with the same content. Be careful with it, because you may
# send the same message to your users
# the embargo of the message will be increased with the repetition interval you choose
# also read the README.repetition for more info
define("USE_REPETITION",1);


As of version 2.10.x the repetition feature can also work in conjunction with the [URL] feature, which allows the inclusion of dynamically created web pages --for instance, a web page that changes every day or every hour can be sent as a daily or hourly message.
Note: see below for a bug fix, usually necessary to make this feature work.


Exclusion of times and dates


Even if you set PHPlist to send every certain interval, you can still tell it to NOT send (ie re-schedule) the message at certain moments, by using the repeat_exclude setting in config.php, and adding the following to your config file:

# exclude dates for repetition
$repeat_exclude = array(
  array("format" => "%a", "values" => array("Sun","Sat")),
  array("format" => "%d-%m-%Y","values" => array("31-01-2004","01-01-2005")),
);


You can add as many entries as you like and the format is as follows:

array("format" => [format], "values" => array([list of values])),


where the bits between [ and ] can be chosen as you like it, but they have to fit the following:
  • [format] needs to be a MySQL data format string
  • [list of values] needs to be a list of values that this format can return, which then, if matched with the new "embargo" for a message will not create a message for that date, but instead increases the "repetition value" to find the next one in a row.

So for example, for excluding the weekend you would use:

 array("format" => "%a", "values" => array("Sun","Sat")),


and for excluding specific dates you can use:

 array("format" => "%d-%m-%Y","values" => array("31-01-2004","28-08-2004")),



A bug


A typical use of the repetition feature is with sending a web page with dynamic content. In PHPList 2.10.2 and earlier, there is a bug that seems to affect many or most PHPList installations. PHPList caches the dynamic web page, and the bug keeps PHPList from checking/updating the dynamic web page as needed.

So, if you use the repetition feature with a dynamic web page as message content, but find that the content of the email never updates, look at this bug report and the suggested fix: http://mantis.phplist.com/view.php?id=7684




CategoryDocumentation
Page was generated in 0.1753 seconds