NAME
Ezmlm - Object Methods for Ezmlm Mailing Lists
SYNOPSIS
use Mail::Ezmlm;
$list = new Mail::Ezmlm;
The rest is a bit complicated for a Synopsis, see the description.
ABSTRACT
Ezmlm is a Perl module that is designed to provide an object interface to the ezmlm mailing list manager software. See the ezmlm web page (http://www.ezmlm.org/) for a complete description of the software.
This version of the module is designed to work with ezmlm version 0.53. It is fully compatible with ezmlm's IDX extensions (version 0.4xx and 5.0 ). Both of these can be obtained via anon ftp from ftp://ftp.ezmlm.org/pub/patches/
DESCRIPTION
Setting up a new Ezmlm object:
use Mail::Ezmlm;
$list = new Mail::Ezmlm;
$list = new Mail::Ezmlm('/home/user/lists/moolist');
Changing which list the Ezmlm object points at:
$list->setlist('/home/user/lists/moolist');
Getting a list of current subscribers:
- Two methods of listing subscribers is provided. The first prints a list of subscribers, one per line, to the supplied FILEHANDLE. If no filehandle is given, this defaults to STDOUT. An optional second argument specifies the part of the list to display (mod, digest, allow, deny). If the part is specified, then the FILEHANDLE must be specified.
-
$list->list; $list->list(\*STDERR); $list->list(\*STDERR, 'deny');
- The second method returns an array containing the subscribers. The optional argument specifies which part of the list to display (mod, digest, allow, deny).
-
@subscribers = $list->subscribers; @subscribers = $list->subscribers('allow');
Testing for subscription:
$list->issub('nobody@on.web.za');
$list->issub(@addresses);
$list->issub(@addresses, 'mod');
issub() returns 1 if all the addresses supplied are found as subscribers of the current mailing list, otherwise it returns undefined. The optional argument specifies which part of the list to check (mod, digest, allow, deny).
Subscribing to a list:
$list->sub('nobody@on.web.za');
$list->sub(@addresses);
$list->sub(@addresses, 'digest');
sub() takes a LIST of addresses and subscribes them to the current mailing list. The optional argument specifies which part of the list to subscribe to (mod, digest, allow, deny).
Unsubscribing from a list:
$list->unsub('nobody@on.web.za');
$list->unsub(@addresses);
$list->unsub(@addresses, 'mod');
unsub() takes a LIST of addresses and unsubscribes them (if they exist) from the current mailing list. The optional argument specifies which part of the list to unsubscribe from (mod, digest, allow, deny).
Creating a new list:
$list->make(-dir=>'/home/user/list/moo',
-qmail=>'/home/user/.qmail-moo',
-name=>'user-moo',
-host=>'on.web.za',
-user=>'onwebza',
-switches=>'mPz');
make() creates the list as defined and sets it to the current list. There are three variables which must be defined in order for this to occur; -dir, -qmail and -name.
- -dir is the full path of the directory in which the mailing list is to be created.
- -qmail is the full path and name of the .qmail file to create.
- -name is the local part of the mailing list address (eg if your list was user-moo@on.web.za, -name is 'user-moo').
- -host is the name of the host that this list is being created on. If this item is omitted, make() will try to determine your hostname. If -host is not the same as your hostname, then make() will attempt to fix DIR/inlocal for a virtual host.
- -user is the name of the user who owns this list. This item only needs to be defined for virtual domains. If it exists, it is prepended to -name in DIR/inlocal. If it is not defined, the make() will attempt to work out what it should be from the qmail control files.
- -switches is a list of command line switches to pass to ezmlm-make(1). Note that the leading dash ('-') should be ommitted from the string.
make() returns the value of thislist() for success, undefined if there was a problem with the ezmlm-make system call and 0 if there was some other problem.
See the ezmlm-make(1) man page for more details
Determining which list we are currently altering:
$whichlist = $list->thislist;
print $list->thislist;
Getting the current configuration of the current list:
$list->getconfig;
getconfig() returns a string that contains the command line switches that would be necessary to re-create the current list. It does this by reading the DIR/config file (idx < v5.0) or DIR/flags (idx >= v5.0) if one of them exists. If it can't find these files it attempts to work things out for itself (with varying degrees of success). If both these methods fail, then getconfig() returns undefined.
$list->ismodpost;
$list->ismodsub;
$list->isremote;
$list->isdeny;
$list->isallow;
The above five functions test various features of the list, and return a 1 if the list has that feature, or a 0 if it doesn't. These functions are considered DEPRECATED as their result is not reliable. Use "getconfig" instead.
Updating the configuration of the current list:
$list->update('msPd');
update() can be used to rebuild the current mailing list with new command line options. These options can be supplied as a string argument to the procedure. Note that you do not need to supply the '-' or the 'e' command line switch.
@part = $list->getpart('headeradd');
$part = $list->getpart('headeradd');
$list->setpart('headerremove', @part);
getpart() and setpart() can be used to retrieve and set the contents of various text files such as headeradd, headerremove, mimeremove, etc.
Manage language dependent text files
$list->get_available_text_files;
$list->get_text_content('sub-ok');
$list->set_text_content('sub-ok', @content);
These functions allow you to manipulate the text files, that are used for automatic replies by ezmlm.
$list->is_text_default('sub-ok');
$list->reset_text('sub-ok');
These two functions are available if you are using ezmlm-idx v5.0 or higher. is_text_default() checks, if there is a customized text file defined for this list. reset_text() removes the customized text file from this list. Ezmlm-idx will use system-wide default text file, if there is no customized text file for this list.
Change the list's settings (for ezmlm-idx >= 5.0)
Mail::Ezmlm->get_config_dir;
$list->get_config_dir;
$list->set_config_dir('/etc/ezmlm-local');
These functions access the file 'conf-etc' in the mailing list's directory. The static function (first example) always returns the default configuration directory of ezmlm-idx (/etc/ezmlm).
$list->get_available_languages;
$list->get_lang;
$list->set_lang('de');
$list->get_charset;
$list->set_charset('iso-8859-1:Q');
These functions allow you to change the language of the text files, that are used for automatic replies of ezmlm-idx (since v5.0 the configured language is stored in 'conf-lang' within the mailing list's directory). Customized files (in the 'text' directory of a mailing list directory) override the default language files. Empty strings for set_lang() and set_charset() reset the setting to its default value.
Get the installed version of ezmlm
Mail::Ezmlm->get_version;
The result is one of the following: 0 - unknown 3 - ezmlm 0.53 4 - ezmlm-idx 0.4xx 5 - ezmlm-idx 5.x 5.1 - ezmlm-idx 5.1 6 - ezmlm-idx 6.x 7 - ezmlm-idx 7.x
Creating MySQL tables:
$list->createsql();
Currently only works for MySQL.
createsql() will attempt to create the table specified in the SQL connect options of the current mailing list. It will return an error if the current mailing list was not configured to use SQL, or is Ezmlm was not compiled with MySQL support. See the MySQL info pages for more information.
Checking the Mail::Ezmlm and ezmlm version numbers
The version number of the Mail::Ezmlm module is stored in the variable $Mail::Ezmlm::VERSION. The compatibility of this version of Mail::Ezmlm with your system installed version of ezmlm can be checked with
$list->check_version();
This returns 0 for compatible, or the version string of ezmlm-make(2) if the module is incompatible with your set up.
RETURN VALUES
All of the routines described above have return values. 0 or undefined are used to indicate that an error of some form has occoured, while anything >0 (including strings, etc) are used to indicate success.
If an error is encountered, the functions
$list->errno();
$list->errmsg();
can be used to determine what the error was.
errno() returns; 0 or undef if there was no error. -1 for an error relating to this module. >0 exit value of the last system() call.
errmsg() returns a string containing a description of the error ($! if it was from a system() call). If there is no error, it returns undef.
For those who are interested, in those sub routines that have to make system calls to perform their function, an undefined value indicates that the system call failed, while 0 indicates some other error. Things that you would expect to return a string (such as thislist()) return undefined to indicate that they haven't a clue ... as opposed to the empty string which would mean that they know about nothing :)
AUTHOR
Guy Antony Halse <guy-ezmlm@rucus.net>
Lars Kruse <devel@sumpfralle.de>
BUGS
There are no known bugs.
Please report bugs to the author or use the bug tracking system at
https://systemausfall.org/trac/ezmlm-web.
SEE ALSO
ezmlm(5), ezmlm-make(2), ezmlm-sub(1),
ezmlm-unsub(1), ezmlm-list(1), ezmlm-issub(1)
http://rucus.ru.ac.za/~guy/ezmlm/
https://systemausfall.org/toolforge/ezmlm-web
http://www.ezmlm.org/
http://www.qmail.org/
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 980:
'=item' outside of any '=over'
- Around line 997:
You forgot a '=back' before '=head2'