James has built-in support for the handling of mailing lists, and users can subscribe and unsubscribe to these lists.
To create a list, you must add the following to the config.xml file in the root processor block and above the final mailet block:
<mailet match="CommandForListservfirstname.lastname@example.org" class="AvalonListservManager"> <repositoryName>list-james</repositoryName> </mailet>
With the mailet above, if a sender sends a message to email@example.com, the sender is subscribed. Similarly, if he or she sends a message to firstname.lastname@example.org, he or she is unsubscribed.
Subscribers are stored in a repository, which can be your file system or a database. The following is an example of the syntax that is necessary to define the repository to the file system:
<repository name="list-james" class="org.apache.james.userrepository.UsersFileRepository"> <destination URL="file://repo/"/> </repository>
To handle the mail, you must also have the mailet in our config.xml file:
<mailet match="RecipientIsemail@example.com" class="AvalonListserv"> <membersonly> false </membersonly> <attachmentsallowed> true </attachmentsallowed> <replytolist> true </replytolist> <repositoryName>list-james</repositoryName> <subjectprefix>JamesList</subjectprefix> </mailet>
With the mailet above, if you send a message to firstname.lastname@example.org, subscribers will receive incoming messages.