The Mailman Command Line Shell

This document describes the usage of the Mailman Command line shell, using which you can query a mailman installation with ease.

Firing and Exiting the Shell

You can start the mailman shell by executing the mmclient command, without any arguments:

$ ./mmclient
Mailman Command Line Interface
>>>

To exit the shell, use the EOF character, that is, Ctrl + d.

Displaying Mailman Objects

The shell can be used to display the mailman objects, using the show command.

For example:

>>> show users
>>> show domains
>>> show lists

Further, the CLI supports filtering of mailman objects based upon their attribute values or properties, using a where clause. For this, the CLI employs 3 filters, which are:

=        Equality
like     Case insensitive regular exp mathcing
in       Search inside a property which list

These filteres can be used in conjunction by using an and clause

Examples:

>>> show users where `display_name` = `Foo`
>>> show users where `display_name` like `.*Foo*`
>>> show lists where `foo@bar.com` in `moderators`
>>> show lists where `foo@bar.com` in `moderators` and `a@b.com` in `owners`

The Shell Environment

The shell provides a facility to create variables that can be used to make the querying easier.

For using the shell, two commands, set and unset are used.

Example:

>>> set `useremail` = `foo@bar.com`

The variables can be used in the queries as follows:

>>> show lists where `$useremail` in `moderators`

The $username will be replaced with the value of useremail

The environment can be disabled using the disable environemt command, that prevents the CLI from replacing the query terms with environment variables, or appending of the specialised variables.

The disabled environment can be enabled using the enable env command.:

>>> disable env
>>> enable env

The environment supports a set of special variables, which denote the names of the scopes available in mailman. They are domain, list and user.

The special environment variables are appended automatically with relevant commands

For example, if the environment variable domain is set to a domain name, then the `show list ` command automatically applies a domain = <set domain> filter to the result list.:

>>> set `domain` = `domain.org`
>>> show lists            //Shows lists under domain.org
>>> disable env
>>> show lists            //Shows all lists
>>> enable env

The value of stored variables can be viewed using the show_var command:

>>> show_var `domain`

Create Objects

The Mailman objects can be created using the create command

The create command accepts the object properties and creates the object.

If the supplied arguments are invalid or insufficient, the list of arguments that are required are displayed.

The create command can be used as follows:

>>> create list where `fqdn_listname` = `list@domain.org`
>>> create domain where `domain` = `domain.org` and `contact` = `a@b.com`
>>> create user where `email` = `foo@bar.com` and `password` = `a` and `name` = `Foo`

Delete Objects

The Mailman objects can be deleted using the delete command. The delete command supports the same filters as those by the show command.

For example:

>>> delete domain where `domain` like `test_.*`

Subscription

The subscription commands include two commands, subscribe and unsubscribe users, which are respectively used to subscribe users to a list and unsubscribe users from a list. The commands allow applying the action on a single user or multiple users at a time.:

>>> subscribe users `a@b.com` `foo@bar.com` to `list@domain.org`
>>> unsubscribe users `a@b.com` `foo@bar.com` from `list@domain.org`

Update Preferences

Preferences can be updated using the shell for the following domains
  • Globally
  • Users
  • Members
  • Addresses

The actions are performed using the update command which can be used as follows:

>>> update preference `<preference_name>` to `<value>` globally
>>> update preference `<preference_name>` to `<value>` for member with `email` = `foo@bar.com`
    and `list` = `list@domain.org`
>>> update preference `<preference_name>` to `<value>` for user with `email` = `foo@bar.com`
>>> update preference `<preference_name>` to `<value>` for address with `email` = `foo@bar.com`