These files are used by Sympa as service messages for HELP,
LISTS and REMIND * commands. These files are interpreted
(parsed) by Sympa and respect the template format ; every file has a .tpl extension.
See 6.2,
page .
Sympa looks for these files in the following order :
If the file starts with a From: line it is considered as a full message and will be sent (after parsing) without adding SMTP headers. Else file is taken as a text/plain message body.
The following variables may be used in these template files :
This file is sent in response to a HELP command. You may use additional variables
File returned by LISTS command. An additional variable is available :
Example:
Here are public lists for [conf->email]@[conf->host] [FOREACH l IN lists] [l->NAME]: [l->subject] [END]
This file is sent in used by REMIND * command.
(see 9.2, page )
You may use additional variables
Example:
This is a subscription reminder. You are subscribed to the following lists : [FOREACH l IN lists [l] : [conf->wwsympa\_url]/info/[l] [END] Your subscriber email : [user->email] Your password : [user->password]
Template files within Sympa and World Wide Sympa are text files containing programming elements (variables, conditions, loops, file inclusions) that will be parsed in order to adapt to the runtime context. These templates are an extension of programs and therefore give access to a limited list a variables (those defined in the 'hash' parameter given to the parser).
Review the Site template files (6.1, page )
and List template files (7.7, page
).
Let us describe the syntaxic elements of templates.
Variables are enclosed between brackets '[]'. The variable name is composed of alphanumericals (0-1a-zA-Z) or underscores (_). The syntax for accessing an element in a 'hash' is [hash->elt].
Examples:
[url] [is_owner] [list->name] [user->lang]
Foreach template you wish to customize, check the available variables in the documentation.
Conditions include variables comparisons (= and <>) or existance. Conditions syntaxic elements are [IF xxx], [ELSE], [ELSIF xxx] and [ENDIF].
Examples:
[IF user->lang=fr] Bienvenue dans la liste [list->name] [ELSIF user->lang=es] Bienvenida en la lista [list->name] [ELSE] Welcome in list [list->name] [ENDIF] [IF is_owner] The following commands are available only for lists's owners or moderators: .... [ENDIF]
Loops allows to go through a list of elements (internally represented by a 'hash' or an 'array').
Example :
A review of public lists [FOREACH l IN lists] [l->NAME] [l->subject] [END]
[elt->NAME] is a special element of the current entry providing the key in the 'hash' (here the list name). When going the an 'array', [elt->INDEX] is the index of the current entry.
You can include another file within a template . The specified file can be included asis or parsed itself (there is no loop detection). The file path is either specified in the directive or accessed in a variable.
Inclusion of a text file :
[INCLUDE 'archives/last_message'] [INCLUDE file_path]
The first example includes a file which relative path is archives/last_message. The second example includes a file which path is in file_path variable.
Inclusion and parsing of a template file :
[PARSE 'welcome.tpl'] [PARSE file_path]
The first example includes the template file welcome.tpl. The second example includes a template file which path is in file_path variable.
Sympa has originally been designed as a multi-lingual Mailing List Manager. First versions of Sympa already separated messages from the code itself, messages being stored in NLS catalogues (according to XPG4 standard). Later a lang list parameter was introduced. Now Sympa also keeps track of users' language preference.
Every message sent by Sympa to users, owners, editors is outside the code, in a message catalog. These catalogs are located in ~sympa/nls/ directory. These messages have currently been translated into 6 different languages :
To tell Sympa to use a message catalog, you can either set the lang parameter in sympa.conf or set sympa.pl -l option on the command line.
lang list parameter defines the language for a list. It is currently used by World Wide Sympa and to initialize user's language preference at subscription time.
In future versions, all messages returned by Sympa concerning a list should be in the list's language.
The user language preference is currently exploited by World Wide Sympa only. There is no email-based command for a user to set his/her language. The language preference is initialized when the user subscribes to his/her first list. World Wide Sympa allows the user to change it.
List parameters controlling commands' behaviour are defined using a scenario. Example
subscribe open_notify match([sender], /cru\.fr$/) smtp -> do_it true() smtp -> owner
Where Sympa accepts subscription requests from anyone domain univ-rennes1.fr. Other requests are forwarded to the owner. The goal is to allow fine and flexible list configuration for each command.
Scenari can also contain includes :
subscribe include commonreject match([sender], /cru\.fr$/) smtp -> do_it true() smtp -> owner
In this case sympa apply reccursively the scenario named include.commonreject before introducin the other rules. This as been introduced in order to made a liter administration of common rules.
A bunch of scenari is provided with Sympa distribution ; it provides all possible configurations as defined in previous releases of Sympa (<= 2.3) whithout any change in your list configuration files.
These standard scenari are located in ~sympa/bin/scenari/ directory. Default scenari are named <command>.default.
You may also define and name your own scenari. Store them in ~sympa/etc/scenari directory. Example:
Copy the previous scenario in scenari/subscribe.rennes1 :
match([sender], /univ-rennes1\.fr$/) smtp -> do_it true() smtp -> owner
You may now refer to this scenario in any list configuration file as :
subscribe rennes1
A scenario consists in rules, evaluated from the first to the last. Rules are defined as follows :
<rule> ::= <condition> <auth> -> <action> <condition> ::= [!] <condition | true () | equal (<var>, <var>) | match (<var>, /perl_regexp/) | is_subscriber (<listname>, <var>) | is_owner (<listname>, <var>) | is_editor (<listname>, <var>) | is_listmaster (<var>) <var> ::= [email] | [sender] | [host] | [header-><smtp\_key\_word>] | <string> <listname> ::= [listname] | <listname_string> <auth> ::= smtp | md5 <action> ::= do_it [,notify] | do_it [,quiet] | reject | request_auth | owner
perl_regexp can containt the string [host] (it will be interpreted at run time as the list or robot domain. The variable notation [header-><smtp_key_word>] is interpreted as the SMTP header value only when performing the sending message scenario. It can be use for exemple to ask editor validation for multipart messages.
Sympa can detect loops due to command reports. Example of loop:
1 - X sends a command to Sympa 2 - Sympa sends a command report to X 3 - X has installed a home-made vacation program replying to programs 4 - Sympa processes the reply and sends a report 5 - Looping to step 3
Sympa keeps track of each reports sent to an address in an internal counter. The loop detection algorithm is :