Lyris User's Guide
[previous] [next] [contents]
How can I extend Lyris with my own programs?
Table of Contents
Lyris Email Commands
Web Interface for Users
Server Administrator
Site Administrator
List Administrator
Other Topics
Add-On Packages
Installing and Upgrading
Frequently Asked Questions
Running Lyris
How can I extend Lyris with my own programs?
How can I be Certain My Email Messages Were Delivered?
What Email Commands does Lyris Support?
Why Does Lyris Not Use Sendmail?
How do I subscribe people automatically?
Lyris Administration
Web Browsers
Usenet Newsgroups
Other FAQ issues
Mailing List Features
Perl/Lyris Toolkit
Unix Administration
Up & Coming

How can I extend Lyris with my own programs?

Lyris allows you to add your own programs into the Lyris execution stream. Extensions can be added to action phrases, auto-responders, list postings, and the lyris@ list server address.

Your scripts can let the normal Lyris execution stream continue, or they can interrupt it.

For example, you can write an extension that logs each use of an auto-responder. This would allow you to keep track of when people received information, and you could this information to follow up with them. Or, perhaps your autoresponder is programmed to send one document to people inside your company, and another document to people outside your company. In such a case, your program would actually replace the default auto-responder behavior.

Another use of technology would be to extend the checking Lyris does on list postings. For example, your script might count the number of greater-than symbols, (">") which indicate message quoting, and refuse messages postings where the bulk of the posting is a quote of someone else's message.

To add your own extensions to Lyris, you need to tell Lyris when you want it to run your program. In the configuration screens for Action Phrases and Auto-Responders, List Settings and Server Settings, there are two fields for extension scripts. This gives you the option to run a script before the default Lyris action takes place, and to run a script after the action has taken place.

With an auto-responder extension, your script will be run any time a email message comes in to the auto-responder's email address. This is similar to adding a program to the sendmail "aliases" file.

With an action-phrase extension, your script will be run any time the action phrase is found in the context it is defined for. For example, you could trap for offensive words in a message posting to your list, and your script would be run when the action phrase saw them. Note that because action phrases can be attached to auto-responders, list postings, and the lyris@ address, that multiple scripts can be run. For instance, if you have an action phrase extension, and a auto-responder extension, if the action phrase is found on that auto-responder, it will run, then the auto-responder extension will run.

With a List extension, your script is run any time a posting is made to the mailing list. Your can prevent the list posting from being accepted by deleting it before the default action is taken.

With a lyris@ extension (set in the server configuration page) you can add your own processing to the processing of list server commands which Lyris does.

You can write your script using any programming language, though we recommend using a language that has access to the Lyris API, such as Perl or C/C++. When Lyris runs your script, it passes the Incoming Message ID of the message in question through the environment variable MESSAGEID. You also have the option of specifying the Message ID over the command line, by specifying $MESSAGEID on in your extension command line. So, for instance, if you are on Windows, and have a Perl script named "" that you want to run, your command line might be:

    c:\perl5\bin\perl.exe c:\scripts\ $MESSAGEID

This runs the Perl interpreter (perl.exe) against your script, and passes the Incoming Message ID on the command line (as well as over the environment variable MESSAGEID).

Normally, your script will use the Message ID to load the message in question, and perform some action. By default, when your program exits, Lyris will continue processing the message. However, if you want Lyris to stop processing the message after your script has run, you should delete the Message. In Perl, this is done with the command &InMailDelete($MessageID);

Your Lyris installation includes a sample extension script, written in perl, with the filename "". By default, it is located in your web server's CGI-BIN directory, and in your ~/lyris/web directory. It is a minimal script that loads the fields for the message in question, displays the fields on the screen, and optionally deletes the message to stop the normal message processing.

Other pages which link to this page:
  • Run program before lyris@
  • Run program after lyris@
  • Run a program before Phrase
  • Run a program after Phrase
  • Run a program before Auto-Responder
  • Run a program after Auto-Responder
  • Run a program before Posting
  • Run a program after Posting
  • New in Version 2.5
  • New in Version 2.0
  • Email
  • Page 519 of 556