HOWTO migrate from mailman2 to discourse


mailman2discourse is a command line tool to import a mailman2 configuration (as found in the config.pck file) into a discourse category available on PyPI. A user is created for each member of the mailing list and they are notified when a new message is posted to the category (unless their mailman2 option was to never receive any mail). The moderators of a private mailing list become members of a discourse group who can review every new post. If the archives of the mailing list are not public, the discourse category is only visible to a discourse group mimicing the mailman2 membership list.


$ pipenv install mailman2discourse



  • API Key (from /admin/api/keys/new) with a User Level of All Users
  • An admin user (for instance admin)
  • An mbox importer container with
    • Not including - “templates/web.ratelimited.template.yml”
  • The config.pck file of the mailman2 mailing list

To import the mailman2 mailing list:

    $ mailman2discourse --url --api-key APIKEY --api-user admin \
                      --mailman-config config.pck \
                      --list listname --domain

The import is idempotent, meaning it is safe to run it multiple times, for instance if it was interrupted or when the config.pck file is updated.

The content of the archives can then be imported.

Archive import

The mailing list archives can be imported using the mbox
. The .mbox and .mbox.gz must be placed in a directory that has the
same name as the category created by mailman2discourse.

Bug reports

The best place to report problems is the issue tracker but posting on this topic is also fine.


I started working on this script last year and had the opportunity to put it to the test in May 2021 when migrating the Spip mailing lists. The script is still very young but I’m now confident that it is usable.

There still are many manual steps involved in the import and I would love to have something like discourse import --mailman2 config.pck mbox-archives-directory that would “just work”. However I don’t plan to implement this. I’m happy with custom shell scripts and I don’t see how they could be generalized. In any case the logic implemented by mailman2discourse is one piece of the puzzle that was missing and I’m happy it exists :slight_smile:


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.