This page still contains text related to James 2.3 and needs to be updated for James 3.0

List Manager Configuration

Consult james-listmanager.xml in SVN to get some examples and hints.

One of the frequent questions on the James-User Mailing List is how to create a mailing list. This document explains one way of using the currently supplied Matchers and Mailets in James v3.0.

Basically, the process requires creating two <mailet> entries and a repository. The first mailet handles list commands (currently only list-name-on and list-name-off). The second mailet handles list messages. The repository will hold the e-mail addresses of list subscribers.

The mailets go into the processor chain (e.g., at the top of the transport processor), the repository goes into the <users-store> block.

Setting up the Repository

The mailing list mailets need a repository within which to store the subscriber list. There is a separate repository for each mailing list, and is completely independent of the user repository used by James to manage e-mail accounts. This is configured in the <users-store> block of james-listmanager.xml.

The following illustrates a database-backed repository using JDBC with the ListUsersJdbcRepository class. Notice that there will be a single table, lists, created in the db://maildb resource defined elsewhere. There are currently two columns: the list name and the list subscriber.

<repository name="list-name"
               class="org.apache.james.userrepository.ListUsersJdbcRepository"
               destinationURL="db://maildb/lists/list-name">
  <sqlFile>file://conf/sqlResources.xml</sqlFile>
</repository>
    

The following illustrates a file-system repository using the UsersFileRepository class. [Note: the destination URL is a child element when configuring a file-system repository, and an attribute when configuring a database-backed repository. This inconsistency will be addressed in a future version of James.]

<repository name="list-name"
               class="org.apache.james.userrepository.UsersFileRepository">
  <destination URL="file://var/lists/list-name/" /> 
</repository>
    

Alternate Explanation

James currently includes only the most basic list functionality, users can subscribe and unsubscribe, but there is no moderation of messages or subscriptions

To enable a list you need the following in config.xml in the root processor block and above the final mailet block -

<mailet match="CommandForListserv=james@localhost"
    class="AvalonListservManager">
    <repositoryName>list-james</repositoryName>
</mailet>

that will intercept the command emails sent to

  • james-on@localhost to subscribe the sender
  • james-off@localhost to unsubscribe the sender

and-

<mailet match="RecipientIs=james@localhost" class="AvalonListserv">
    <membersonly> false </membersonly>
    <attachmentsallowed> true </attachmentsallowed>
    <replytolist> true </replytolist>
    <repositoryName>list-james</repositoryName>
    <subjectprefix>JamesList</subjectprefix>
</mailet>

Which will distribute the mail to the current subscribers

in addition to the above you need to have a repository configured in the users-store block(usually near the bottom of config.xml) like so (database)-

<repository name="list-james"
    class="org.apache.james.userrepository.ListUsersJdbcRepository"
    destinationURL="db://maildb/lists/list-james">
    <sqlFile>file://conf/sqlResources.xml</sqlFile>
</repository>

Database users will also need to ensure that they have configured a data-source named to match the destination URL

Using the filesystem:-

<repository name="list-james"
    class="org.apache.james.userrepository.UsersFileRepository">
    <destination URL="file://var/lists/list-james/"/>
</repository>

Restart James, send a mail to james-on@localhost and you should be subscribed.

The repository, be it a database table or directory in the filesystem will be created automatically.

Database users can manipulate the users repository using SQL, and hence any application capable of running SQL queries against it.

miResources.xml

Consult miResources.xml in SVN to get some examples and hints.