How To Move A Mailman Mailing List Between Domains Or Servers

2011-09-03 13:11

I have a VPS (virtual Private Server) running CentOS 5.4 and Plesk Web-hosting management software. Under Plesk, Mailman is installed; this mailing-list management package is not necessarily present by default in Linux distributions.

I host a few dozen domains with a number of Mailman mailing lists scattered across them. Recently I had occasion to move a mailing list from one domain to another on the same server. It was not immediately clear how to go about this, and Googling didn’t turn up much that was helpful. So I’m documenting the process here in case it proves useful to others.

The technique, with suitable modifications, works as well to move a list from one Linux server to another.

Caveat

The file-system locations I discovered for components of the Mailman infrastructure may be dependent on Plesk. A by-hand install of Mailman on a Linux system may put things in different places. Other management software such as Cpanel may make different decisons. I located Mailman’s archive of past messages by the below. You could find Mailman’s binaries directories by a similar search for “list_lists.”

#  find / -name \*archives\* -print | grep 'private' | more

Overview and tools

To move a list, it must be deleted and recreated. We will save three things from the original list and restore to the new one: list configuration, list membership, and list archive. To do so we’ll be using the command line on the Linux server, and the Plesk management iterface. The mailing list in the example below is assumed to be a private one. if not, substitute public in steps 3. and 7. below.

0. Perform the command-line actions as root

%  sudo su -l root
Password:

1. Save list settings (command line)

#  cd /usr/lib/mailman/bin/

#  ./list_lists
3 matching mailing lists found:
           List-1 - Just some mailing list
           List-2 - Just another mailing list
          TheList - The list we are interested in

#  ./config_list -o /tmp/TheList.conf TheList

2. Save list membership (command line)

Assuming the list has both regular members (who receive every message as it is sent) and digest members (who receive a collection of messages once per day), these commands will save lists of both.

#  cd /usr/lib/mailman/bin/

#  ./list_members -o /tmp/TheList-regular.txt -r TheList

#  ./list_members -o /tmp/TheList-digest.txt -d TheList

3. Save list archive (command line)

#  cd /var/lib/mailman/archives/private

#  ls -lF
total 32K
drwxrwsr-x 12 root mailman 4.0K Jan 15  2011 List-1/
drwxrwsr-x  2 root mailman 4.0K Apr  9  2010 List-1.mbox/
drwxrwsr-x  4 root mailman 4.0K Nov 24  2010 List-2/
drwxrwsr-x  2 root mailman 4.0K Nov 23  2010 List-2.mbox/
drwxrwsr-x 55 root mailman 4.0K Sep  2 03:27 TheList/
drwxrwsr-x  2 root mailman 4.0K Apr  8  2010 TheList.mbox/
drwxrwsr-x  2 root mailman 4.0K Apr  7  2010 mailman/
drwxrwsr-x  2 root mailman 4.0K Apr  7  2010 mailman.mbox/

#  tar czf /tmp/TheList-archive.tgz TheList

#  tar czf /tmp/TheList-mbox-archive.tgz TheList.mbox

4. Remove list from domain A; create list in domain B (Plesk UI)

Log in to the Plesk management UI. Click on the domain that is currently the home of TheList. Click Mailing Lists. On the resulting page, select the checkbox to the left of TheList and click Remove. Next is a confirmation page. Click the checkbox to the left of Confirm removal and click OK. This should remove all traces of TheList from the original domain, including the list archive.

Return to Plesk’s list of domains and select the target domain for TheList. Click Mailing Lists and then Add New Mailing List. Fill out the list name (TheList), an administrative password (twice), and the email address of the list administrator. Click OK. A new mailing list with default options is created under the new domain.

5. Restore list settings (command line)

#  cd /usr/lib/mailman/bin/

#  ./list_lists
3 matching mailing lists found:
           List-1 - Just some mailing list
           List-2 - Just another mailing list
          TheList - The list we are interested in

#  ./config_list -i /tmp/TheList.conf TheList

6. Restore list membership (command line)

#  cd /usr/lib/mailman/bin/

#  ./add_members -r /tmp/TheList-regular.txt TheList

#  ./add_members -d /tmp/TheList-digest.txt TheList

7. Restore list archive (command line)

#  cd /var/lib/mailman/archives/private

#  tar xzf /tmp/TheList-archive.tgz

#  tar xzf /tmp/TheList-mbox-archive.tgz

Note: If you are moving the list from one server to another, the values of user root and group mailman might differ. (If you saw a different user and/or group in step 3., substitute those instead.) In this case add the following step:

#  chown -R root:mailman TheList TheList.mbox

  

---
~~-