Home > Articles

  • Print
  • + Share This
Like this article? We recommend

Mailing Lists


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="CommandForListserv=james@bogusdomain.com"
    class="AvalonListservManager">
    <repositoryName>list-james</repositoryName>
</mailet>

With the mailet above, if a sender sends a message to james-on@bogusdomain.com, the sender is subscribed. Similarly, if he or she sends a message to james-off@bogusdomain.com, 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="RecipientIs=james@bogusdomain.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 james@bogusdomain.com, subscribers will receive incoming messages.

  • + Share This
  • 🔖 Save To Your Account