This chapter describes these modules (or a part of) :
This module deals with mail sending and does the SMTP job. It provides a function for message distribution to a list, the message can be encrypted. There is also a function to send service messages by parsing tt2 files, These messages can be signed. For sending, a call to sendmail is done or the message is pushed in a spool according to calling context.
mail_file(), mail_message(), mail_forward(), set_send_spool(), reaper().
Message is written by parsing a tt2 file (or with a string ). It writes mail headers if they are missing and they are encoded.
Then the message is sent by calling mail::sending() function (see 28.1.2, page ).
IN :
OUT : 1
Distributes a message to a list. The message is encrypted if needed, in this case, only one SMTP session is used for each recepient
otherwise, recepient are grouped by domain for sending (it controls the number recepient arguments to call sendmail).
Message is sent by calling mail::sendto() function (see 28.1.2, page ).
IN :
OUT : $numsmtp = number of sendmail process undef
Forward a message by calling mail::sending() function (see 28.1.2, page ).
IN :
OUT : 1 undef
Used by other processes than sympa.pl to indicate to send message by
writting message in spool instead of calling mail::smtpto() function (see 28.1.2, page ).
The concerned spool is set in $send_spool global variable, used by mail::sending() function
(see 28.1.2, page
).
IN :
OUT : -
Non blocking function used to clean the defuncts child processes by waiting for them and then
decreasing the counter. For exemple, this function is called by mail::smtpto() (see
28.1.2, page ), main loop of sympa.pl, task_manager.pl,
bounced.pl.
IN :
OUT : the pid of the defunct process -1 if there is no such child process.
sendto(), sending(), smtpto().
Encodes subject header. Encrypts the message if needed. In this case, it checks if there is
only one recepient. Then the message is sent by calling mail::sending() function
(see 28.1.2, page ).
IN :
OUT : 1 - sending by calling smtpto (sendmail) 0 - sending by push in spool undef
Signs the message according to $sign_mode. Chooses sending mode according to context. If $send_spool global variable is empty, the message is
sent by calling mail::smtpto() function (see 28.1.2, page )
else the message is written in spool $send_spool in order to be handled by sympa.pl process (because only this
is allowed to make a fork).
When the message is pushed in spool, these mail headers are added :
IN :
OUT : 1 - sending by calling smtpto() (sendmail) 0 - sending by pushing in spool undef
Calls to sendmail for the recipients given as argument by making a fork and an exec. Before,
waits for number of children process number allowed by sympa.conf by calling mail::reaper() function
(see 28.1.1, page ).
IN :
OUT : mail::$fh - file handle on opened file for ouput, for SMTP "DATA" field undef
This module includes list processing functions.
Here are described functions about :
Follows a description of structure and access on list parameters.
distribute_message(), send_msg(), send_msg_digest().
These functions are used to message distribution in a list.
Prepares and distributes a message to a list :
IN :
OUT : result of List::send_msg() function (number of sendmail process)
This function is called by List::distribute_msg() (see 28.2.1,
page ) to select subscribers
according to their reception mode and to the ``Content-Type'' header field of the message.
Sending are grouped according to their reception mode :
IN :
OUT : $numsmtp : addition of mail::mail_message() function results ( = number of sendmail process ) undef
Sends a digest message to the list subscribers with reception digest, digestplain or summary :
it creates the list of subscribers in various digest modes and then creates the list of
messages. Finally sending to subscribers is done by calling List::send_file() function
(see 28.2.2, page )
with mail template ``digest'', ``digestplain'' or ``summary''.
IN :
OUT :
send_file(), send_global_file().
These functions are used by others to send files. These files are made from template given in parameters.
Sends a message to a user, relative to a list. It finds the $tpl.tt2 file to make the message. If the list has a key and a certificat and if openssl is in the configuration, the message is signed. The parsing is done with variable $data set up first with parameter $context and then with configuration, here are set keys :
IN :
OUT : 1 undef
Sends a message to a user not relative to a list. It finds the $tpl.tt2 file to make the message. The parsing is done with variable $data set up first with parameter $context and then with configuration, here are set keys :
IN :
OUT : 1 undef
archive_send(), send_to_editor(), request_auth(), send_auth().
These functions are used to send services messgase, correponding to a result of a command.
Sends an archive file ($file) to $who. The archive is a text file, independant from web archives.
It checks if the list is archived. Sending is done by callingList::send_file()
(see 28.2.2, page )
with mail template ``archive''.
IN :
OUT : - undef
Sends a message to the list editor for a request concerning a message to distribute.
The message awaiting for moderation is named with a key and is set in the spool queuemod.
The key is a reference on the message for editor.
The message for the editor is sent by calling List::send_file() (see 28.2.2,
page ) with mail template ``moderate''. In msg_topic context, the editor is
asked to tag the message.
IN :
OUT : $modkey - the moderation key for naming message waiting for moderation in spool queuemod. undef
Sends an authentification request for a requested command. The authentification request contains
the command to be send next and it is authentified by a key. The message is
sent to user by calling List::send_file() (see 28.2.2,
page ) with mail template ``request_auth''.
IN :
OUT : 1 undef
Sends an authentifiaction request for a message sent for distribution.
The message for distribution is copied in the authqueue spool to wait for confirmation by its sender .
This message is named with a key. The request is sent to user by calling List::send_file()
(see 28.2.2, page ) with mail template ``send_auth''.
In msg_topic context, the sender is asked to tag his message.
IN :
OUT : $modkey, the key for naming message waiting for confirmation in spool queuemod. undef
send_notify_to_listmaster(), send_notify_to_owner(), send_notify_to_editor(), send_notify_to_user().
These functions are used to notify listmaster, list owner, list editor or user about events.
Sends a notice to listmaster by parsing ``listmaster_notification'' template. The template makes a specified or a
generic treatement according to variable $param.type (:= $operation parameter).
The message is sent by calling List::send_file() (see 28.2.2, page )
or List::send_global_file() (see 28.2.2, page
)
according to the context : global or list context.
Available variables for the template are set up by this function, by $param parameter and by
List::send_global_file() or List::send_file().
IN :
OUT : 1 undef
Sends a notice to list owner(s) by parsing ``listowner_notification'' template. The template makes a specified or a
generic treatement according to variable $param.type ( := $operation parameter).
The message is sent by calling List::send_file() (see 28.2.2, page ).
Available variables for the template are set up by this function, by $param parameter and by
List::send_file().
IN :
OUT : 1 undef
Sends a notice to list editor(s) by parsing ``listeditor_notification'' template. The template makes a specified or a
generic treatement according to variable $param.type ( := $operation parameter).
The message is sent by calling List::send_file() (see 28.2.2, page ).
Available variables for the template are set up by this function, by $param parameter and by
List::send_file().
IN :
OUT : 1 undef
Sends a notice to a user by parsing ``user_notification'' template. The template makes a specified or a
generic treatement according to variable $param.type ( := with $operation parameter).
The message is sent by calling List::send_file() (see 28.2.2, page ).
Available variables for the template are set up by this function, by $param parameter and by
List::send_file().
IN :
OUT : 1 undef
is_there_msg_topic(), is_available_msg_topic(), get_available_msg_topic(), is_msg_topic_tagging_required, automatic_tag(), compute_topic(), tag_topic(), load_msg_topic_file(), modifying_msg_topic_for_subscribers(), select_subscribers_for_topic().
These functions are used to manages message topics.
N.B.: There is some exception to use some parameters : msg_topic.keywords for list parameters and topics_subscriber
for subscribers options in the DB table. These parameters are used as string splitted by ',' but to access to each one, use the function
tools::get_array_from_splitted_string() (see 28.7,
page ) allows to access the enumeration.
Tests if some message topic are defined (msg_topic list parameter, see , page
).
OUT : 1 - some msg_topic are defined 0 - no msg_topic
Checks for a topic if it is available in the list :
look foreach msg_topic.name list parameter (see , page
).
IN :
OUT : topic if it is available undef
Returns an array of available message topics (msg_topic.name list parameter, see , page
).
OUT : ref(ARRAY)
Returns if the message must be tagged or not (msg_topic_tagging list parameter set to 'required', see , page
).
OUT : 1 - the message must be tagged 0 - the msg can be no tagged
Computes topic(s) (with compute_topic() function) and tags the message (with tag_topic() function) if there are some topics defined.
IN :
OUT : list of tagged topic : strings separated by ','. It can be empty. undef
Computes topic(s) of the message. If the message is in a thread, topic is got from the previous message else topic is got from
applying a regexp on the subject and/or the body of the message (msg_topic_keywords_apply_on list parameter,
see, page
). Regexp is based on msg_topic.keywords
list parameters (See
, page
).
IN :
OUT : list of computed topic : strings separated by ','. It can be empty.
Tags the message by creating its topic information file in the /home/sympa/spool/topic/ spool. The file contains the topic list and the method used to tag the message. Here is the format :
TOPIC topicname,... METHOD editor|sender|auto
IN :
OUT : name of the created topic information file (directory/listname.msg_id) undef
Search and load msg topic file corresponding to the message ID (directory/listname.msg_id). It returns information contained inside.
IN :
OUT : undef ref(HASH), keys are :
Deletes topics of subscriber that does not exist anymore
and send a notify to concerned subscribers.
(Makes a diff on msg_topic parameter between the list configuration before modification
and a new state by calling tools::diff_on_arrays() function, see 28.7,
page ). This function is used by wwsympa::do_edit_list().
IN :
OUT :
Selects subscribers that are subscribed to one or more topic
appearing in the topic list incoming when their reception mode is 'mail', and selects the other subscribers
(reception mode different from 'mail'). This function is used by List::send_msg() function during message
diffusion (see 28.2.1, page ).
IN :
OUT : ARRAY - list of selected subscribers
The following function is used to evaluate scenario file ``<action>.<parameter_value>'', where <action>action corresponds to a configuration parameter for an action and <parameter_value> corresponds to its value.
IN :
OUT : undef ref(HASH) with keys :
List parameters are representated in the list configuration file, in the list object (list->{'admin'}) and on the Web interface. Here are translation and access functions :
other (3) | ||||
(1) | (5) | |||
CONFIG FILE | LIST OBJECT | WEB INTERFACE | ||
(2) | (4) | (6) |
List::_load_admin_file(),_load_include_admin_user_file(),_load_list_param()
List::_save_admin_file(),_save_list_param()
List::get_param_value(),_get_param_value_anywhere(),_get_single_param_value()
List::_apply_default()
wwsympa::do_edit_list_request(),_prepare_edit_form(),_prepare_data()
wwsympa::do_edit_list(),_check_new_value
List parameters can be simple or composed in paragraph, they can be unique or multiple and they can singlevalued or multivalued. Here are the different kinds of parameters and an exemple :
parameters | SIMPLE | COMPOSED | |
SINGLE | singlevalued | (a) | (b) |
lang | archiv.period | ||
multivalued | (c) | (d) | |
topics | available_user_option.reception | ||
MULTIPLE | singlevalued | (e) | (f) |
include_list | owner.email | ||
multi values | not defined | not defined |
Here are these list parameters format in list configuration file in front of perl representation in memory :
This is the main script ; it runs as a daemon and does the messages/commands processing. It uses these funstions : DoFile(), DoMessage(), DoCommand(), DoSendMessage(), DoForward(), SendDigest(), CleanSpool(), sigterm(), sighup().
Concerning reports about message distribution, function List::send_file()
(see 28.2.2, page ) or List::send_global_file()
(see 28.2.2, page
) is called with
mail template ``message_report''. Concernong reports about commands, it is the mail template
``command_report''.
Handles a received file : function called by the sympa.pl main loop in order to process files contained in the queue spool. The file is encapsulated in a Message object not to alter it. Then the file is read, the header and the body of the message are separeted. Then the adequate function is called whether a command has been received or a message has to be redistributed to a list.
So this function can call various functions :
IN : file(+): the file to handle
OUT : $status - result of the called function undef
Handles a message sent to a list (Those that can make loop and those containing a command are rejected). This function can call various functions :
IN :
OUT : 1 if everything went fine in order to remove the file from the queue undef
Handles a command sent to sympa. The command is parse by calling Commands::parse() (see
28.4.1, page ).
IN :
OUT : $success - result of Command::parse() function undef.
Sends a message pushed in spool by another process (ex : wwsympa.fcgi) by calling function
mail::mail_forward() (see 28.1.1, page ).
IN :
OUT : 1 undef
Handles a message sent to <listname>-editor : the list editor, <list>-request : the list owner or the listmaster.
The message is forwarded according to $function by calling function
mail::mail_forward() (see 28.1.1, page ).
IN :
OUT : 1 undef
Reads the queuedigest spool and send old digests to the subscribers with the digest option by
calling List::send_msg_digest() function mail::mail_forward() (see 28.2.1,
page ).
IN : - OUT : - undef
Cleans old files from spool $spool_dir older than $clean_delay.
IN :
OUT : 1
This function is called when a signal -TERM is received by sympa.pl.
It just changes the value of $signal loop variable in order to stop sympa.pl after endding its message distribution
if in progress. (see 4.3, page )
IN : - OUT : -
This function is called when a signal -HUP is received by sympa.pl.
It changes the value of $signal loop variable and switchs of the "-mail" (see 4.3,
page ) logging option and continues current task.
IN : - OUT : -
This module does the mail commands processing.
parse(), add(), del(), subscribe(), signoff(), invite(), last(), index(), getfile(), confirm(), set(), distribute(), reject(), modindex(), review(), verify(), remind(), info(), stats(), help(), lists(), which(), finished().
Parses the command line and calls the adequate subroutine (following functions)
with the arguments of the command. This function is called by sympa::DoCommand() (see 28.3,
page ).
IN :
OUT : 'unknown_cmd' $status - command process result
Adds a user to a list (requested by another user), and can send acknowledgements. New subscriber can be notified by sending template 'welcome'.
IN :
OUT : 'unknown_list' 'wrong_auth' 'not_allowed' 1 undef
Removes a user to a list (requested by another user), and can send acknowledgements. Unsubscriber can be notified by sending template 'removed'.
IN :
OUT : 'unknown_list' 'wrong_auth' 'not_allowed' 1
Subscribes a user to a list. New subscriber can be notified by sending him template 'welcome'.
IN :
OUT : 'unknown_list' 'wrong_auth' 'not_allowed' 1 undef
Unsubscribes a user from a list. He can be notified by sending him template 'bye'.
IN :
OUT : 'syntax_error' 'unknown_list' 'wrong_auth' 'not_allowed' 1 undef
Invites someone to subscribe to a list by sending him the template 'invite'.
IN :
OUT : 'unknown_list' 'wrong_auth' 'not_allowed' 1 undef
Sends back the last archive file by calling List::archive_send() function
(see 28.2.3, page ).
IN :
OUT : 'unknown_list' 'no_archive' 'not_allowed' 1
Sends the list of archived files of a list.
IN :
OUT : 'unknown_list' 'no_archive' 'not_allowed' 1
Sends back the requested archive file by calling List::archive_send() function
(see 28.2.3, page ).
IN :
OUT : 'unknown_list' 'no_archive' 'not_allowed' 1
Confirms the authentification of a message for its distribution on a list by calling function
List::distribute_msg() for distribution (see 28.2.1, page )
or by calling List::send_to_editor() for moderation (see
, page
).
IN :
OUT : 'wrong_auth' 'msg_not_found' 1 undef
Changes subscription options (reception or visibility)
IN :
OUT : 'syntax_error' 'unknown_list' 'not_allowed' 'failed' 1
Distributes the broadcast of a validated moderated message.
IN :
OUT : 'unknown_list' 'msg_not_found' 1 undef
Refuses and deletes a moderated message. Rejected message sender can be notified by sending him template 'reject'.
IN :
OUT : 'unknown_list' 'wrong_auth' 1 undef
Sends a list of current messages to moderate of a list (look into spool queuemod) by using template 'modindex'.
IN :
OUT : 'unknown_list' 'not_allowed' 'no_file' 1
Sends the list of subscribers of a list to the requester by using template 'review'.
IN :
OUT : 'unknown_list' wrong_auth no_subscribers 'not_allowed' 1 undef
Verifies an S/MIME signature.
IN :
OUT : 1
Sends a personal reminder to each subscriber of a list or of every list (if $which = *) using template 'remind' or 'global_remind'.
IN :
OUT : 'syntax_error' 'unknown_list' 'wrong_auth' 'not_allowed' 1 undef
Sends the list information file to the requester by using template 'info_report'.
IN :
OUT : 'unknown_list' 'wrong_auth' 'not_allowed' 1 undef
Sends the statistics about a list using template 'stats_report'.
IN :
OUT : 'unknown_list' 'not_allowed' 1 undef
Sends the help file for the software by using template 'helpfile'.
IN :
OUT : 1 undef
Sends back the list of public lists on this node by using template 'lists'.
IN :
OUT : 1 undef
Sends back the list of lists that sender is subscribed to. If he is owner or editor, managed lists are noticed. Message is sent by using template 'which'.
IN :
OUT : 1
Called when 'quit' command is found. It sends a notification to sender : no process will be done after this line.
IN : -
OUT : 1
get_auth_method()
Called by processing command functions to return the authentification method and to check the key if it is 'md5' method.
IN :
This script provides the web interface to Sympa.
do_subscribe(), do_signoff(), do_add(), do_del(), do_change_email(), do_reject(), do_send_mail(), do_sendpasswd(), do_remind(), do_set(), do_send_me(), do_request_topic(), do_tag_topic_by_sender().
Subscribes a user to a list. New subscriber can be notified by sending him template 'welcome'.
Unsubscribes a user from a list. The unsubscriber can be notified by sending him template 'bye'.
Adds a user to a list (requested by another user) and can send acknowledgements. New subscriber can be notified by sending him template 'welcome'.
Removes a user from a list (requested by another user) and can send acknowledgements. Unsubscriber can be notified by sending template 'removed'.
Changes a user's email address in Sympa environment. Password can be send to user by sending template 'sendpasswd'.
Refuses and deletes moderated messages. Rejected message senders are notified by sending them template 'reject'.
Distributes moderated messages by sending a command DISTRIBUTE to sympa.pl. For it, it calls mail::mail_file()
(see 28.1.1, page ). As it is in a Web context, the message will be
set in spool. In a context of message topic, tags the message by calling to function List::tag_topic()
(see 28.2.5, page
).
Allows a moderator to moderate a list of messages and documents and/or tag message in message topic context.
Allows a moderator to moderate a message and/or tag message in message topic context.
Sends a message to a list by the Web interface.
It uses mail::mail_file() (see 28.1.1, page )
to do it. As it is in a Web context, the message will be set in spool.
Sends a message to a user, containing his password, by sending him template 'sendpasswd' list by the Web interface.
Allows a sender to tag his mail in message topic context.
Tags a message by its sender by calling List::tag_topic() and allows its diffusion by sending a command CONFIRM to sympa.pl.
Sends a command remind to sympa.pl by calling mail::mail_file() (see 28.1.1,
page ). As it is in a Web context, the message will be set in spool.
Changes subscription options (reception or visibility)
Sends a web archive message to a requesting user It calls mail::mail_forward() to do it
(see 28.1.1, page ). As it is in a Web context,
the message will be set in spool.
This module provides various tools for notification and error reports in every Sympa interface (mail diffusion, mail command and web command).
For a requested service, there are four kinds of reports to users:
For other reports than non authorizations templates used depends on the interface :
These reports use template mail_tt2/message_report.tt2 and there are two functions : reject_report_msg() and notice_report_msg().
Sends a notification to the user about an error rejecting his requested message diffusion.
IN :
OUT : 1 undef
Sends a notification to the user about a success about his requested message diffusion.
IN :
OUT : 1 undef
A mail can contains many commands. Errors and notices are stored in module global arrays before sending (intern_error_cmd, user_error_cmd, global_error_cmd, auth_reject_cmd, notice_cmd). Moreover used errors here we can have global errors on mail containing commands, so there is a function for that. These reports use template mail_tt2/command_report.tt2 and there are many functions :
Inits global arrays for mail command reports.
IN : -
OUT : -
Looks for some mail command reports in one of global arrays.
IN : -
OUT : 1 if there are some reports to send
Concerns global reports of mail commands. There are many uses cases :
IN :
OUT : 1 undef
Concerns reject reports of mail commands. These informations are sent at the end of the mail processing. There are many uses cases :
IN :
OUT : 1 undef
Concerns positive notices of mail commands. These informations are sent at the end of the mail processing.
IN :
OUT : 1 undef
Sends the template command_report.tt2 to $sender with global arrays and then calls to init_report_command.tt2 function. (It is used by sympa.pl at the end of mail process if there are some reports in gloal arrays)
IN :
OUT : 1
It can have many errors and notices so they are stored in module global arrays before html sending. (intern_error_web, user_error_web, auth_reject_web, notice_web). These reports use web_tt2/notice.tt2 template for notices and web_tt2/error.tt2 template for rejects.
Inits global arrays for web command reports.
IN : -
OUT : -
Looks for some rejected web command reports in one of global arrays for reject.
IN : -
OUT : 1 if there are some reject reports to send (not notice)
Return array of web intern error
IN : -
OUT : ref(ARRAY) - clone of intern_error_web
Return array of web user error
IN : -
OUT : ref(ARRAY) - clone of user_error_web
Return array of web authorisation reject
IN : -
OUT : ref(ARRAY) - clone of auth_reject_web
Return array of web notice
IN : -
OUT : ref(ARRAY) - clone of notice_web
Concerning reject reports of web commands, there are many uses cases :
IN :
OUT : 1 undef
Concerns positive notices of web commands.
IN :
OUT : 1 undef
This module provides various tools for Sympa.
Checks for no command in the body of the message. If there are some command in it,
it returns true and sends a message to $sender by calling List::send_global_file()
(see 28.2.2, page ) with mail
template ``message_report''.
IN :
OUT :
Return an array made from a string splitted by ','. It removes spaces.
IN : string(+): string to split
OUT : ref(ARRAY) -
Makes set operation on arrays seen as set (with no double) :
IN :
OUT : ref(HASH) with keys :
Cleans a msg_id to use it without '
n', '
s', < and >.
IN : msg_id(+): the message id
OUT : the clean msg_id
Lower-case it and remove leading and trailing spaces.
OUT : the clean email
Make an array of include path for tt2 parsing
IN :
OUT : ref(ARRAY) - include tt2 path, respecting path priorities.
This module provides objects to encapsulate file message in order to prevent it from its alteration for using signatures.
Creates an object Message and initialize it :
IN :
OUT : ref(Message) undef
Dump the message object in the file descriptor $output
IN :
OUT : '1'
Adds the message topic in the Message object (topic' and adds the 'X-Sympa-Topic' field in the ref(MIME::Entity) msg'.
IN :
OUT : '1'
Returns the topic(s) of the message
OUT : '' if no message topic | string splitted by ',' if message topic
N.B.: