Random Document Responder
The Lyris List Manager extension "rdoc" performs the task of returning a random document of your choosing in response to receiving incoming mail.
For example, imagine that you wanted an email address of your server to return a random inspirational saying in response to email it received. The email address might be firstname.lastname@example.org, and
the email messages it returns would be things such as "you are somebody special!" and "people like you!".
This documentation page explains how to install this Lyris List Manager extension on your server. This is a good example of a extension script and the kind of functions you can perform with one.
This extension is available at no cost.
Download and Extract the files
First, you will need to obtain the rdoc extension, by downloading rdoc.zip from http://www.lyris.com/down/scripts.html
The rdoc extension files are stored in this ZIP archive, but work equally well on Unix. Use Winzip or Pkunzip or 'unzip' (if you are on Unix) to extract the files out of this archive into a
directory, from which you will run your Lyris List Manager extensions. On Windows, we recommend C:\lyris\ext while on Unix, we recommend /opt/lyris/ext
Copy the file "lyris.plc" into this directory. If you have configured your Lyris List Manager installation to use your web server, the "lyris.plc" file will be in the CGI-BIN directory (or SCRIPTS
directory, if you are using IIS). If you are using the Apache web server installed with Lyris List Manager, this file will be found in the lib directory under Apache.
If you are on Windows and you used a directory other than c:\lyris\ext you will need to edit rdoc.bat to reflect the directory path you used. Also, if your installation of Perl is not located in
c:\perl5 you will also need to edit this file.
If you are on Unix, be sure to do a "chmod 700 /opt/lyris/ext/rdoc.pl" to make the file executable.
Set the Extensions Directory
Go to the Server Config page of the Server Admin menu, and locate the "Extensions Directory" option, which is in the "Programming Extensions" group on the Server Config page.
Set this setting to be the directory where you placed the files from the rdoc archive file. If you followed our recommendations for default directories, you would type "c:\lyris\ext\" on Windows, or
"/opt/lyris/ext/" on Unix. Remember to include the final slash, or your extensions will not work.
Save your new Server Config settings.
Create the Documents
Use the web interface to go into the List Administrator menu, and choose to create a new document.
The "rdoc" extension identifies the correct documents to email by looking at their Document Name. Thus, you will want all your documents to have same beginning name. For example, "inspire-somebody"
and "inspire-like-you". When you define your extension, you will specify the prefix that your documents all share, in this example, the text "inspire".
In the "type" field, be sure to choose "RESPOND", as the "rdoc" extension is pre-programmed to work with documents of that type.
Create as many documents as you want to be included in the rdoc random choice. If you later choose your mind, and want a document to not be considered by the rdoc extension, you can simply change
the title to something else, for example, by changing "inspire-somebody" to "unused-somebody".
Create the Autoresponder
From the List Administrator menu, choose the auto-responders menu and then choose to create an autoresponder.
In the create autoresponder page, put the email address you want the autoresponder to use in "email address", for example, "inspire".
In the "response" field, choose "nothing"
In the "run a program before" field, enter text that looks like this:
rdoc.bat $MESSAGEID list1 inspire email@example.comYou will need to change the items on the command line to fit your needs. The parameters are:
rdoc.bat: this is the program name to run. On Unix, this should be "rdoc.pl"
$MESSAGEID: this is required, in order for the script to know what incoming message to look atSave the autoresponder.
list1: this is the name of the mailing list under which the documents have been created. This tells the rdoc extension what documents to find.
inspire: this is the text prefix that groups the documents together that you created for this rdoc extension. Since all the documents we created had a Name starting with "inspire", that is what we
are using here.
firstname.lastname@example.org: this is the email address that the rdoc extension should use as the From: header for the messages it sends. Usually, this is the email address of the extension itself.
Test the Autoresponder
Use your email program to send an email message to the autoresponder. You should receive a document in a few moments. If the extension does not work correctly, run Lyris List Manager in the
foreground, with debugging information displayed, with the command "lyris start debug". This will show you information when the extension is run and what the problem is.