3.3. How can I remove a post from the list archive / remove an entire archive?
You need to edit the raw archive "mbox" directly, and then regenerate the archive. This requires login access to the command-line prompt on the host where Mailman is running; you'll either need to be in the "mailman" group, or be the "mailman" user. (You could of course do this as root, but that's not recommended – don't do anything as root that you don't absolutely need to do as root.)
If you don't know how to use the command-line prompt on the host where Mailman is installed, or you don't have access to the command-line prompt, you will need to talk to your service provider or your support services personnel in order to perform these functions.
Note that if you are using a cPanel-hosted service (see Mailman and CPanel), you almost certainly will not be allowed to log into the server.
Anyway, assuming you do have the necessary access and knowledge of how to use the command-line system on your server, here is a detailed example. Let's say you want to remove a post from the archive for the "test" list. First, you need to find out where the archive lives:
cd ~mailman ls -ld archive/private/test*
If that finds nothing try:
ls -ld archive/public/test*
If that too finds nothing, then something is wrong. Ask for help on the mailman-users lists.
Let's assume you found the "test" archive in archive/private:
Now you need to edit the raw archive:
(You can use whatever text editor you like, but be sure that it 1) doesn't try to wrap lines or change anything implicitly, and 2) can handle large files, if this is a big list archive.)
Find the message you want to remove, and remove it. Each message starts with a line that looks like:
From firstname.lastname@example.org Wed Sep 26 16:39:08 2001
where, obviously, the sender address and delivery date will vary. You need to delete from the "From " line that starts your target message to the next "From " line, ie. the start of the next message. You MUST have a blank line between the end of the previous message and the start of the next message. For example, after deleting message N, you should have something like this:
[...last line of text from message N-1...] [blank line] From email@example.com Wed Sep 26 17:53:02 2001 [...headers from message N+1...]
NOTE: Instead of editing the .mbox file with an editor, At least one user has reported - I've had good luck using a command-line email program (such as mutt) to delete messages from the archive mbox. I've found this is especially useful for archives that contain many attachments and/or encoded text sections.
Now you need to rebuild the archive visible from the web. First, move the existing archive directory (test, not test.mbox) out of the way:
mv test test.save
and then go rebuild the archive:
cd ~mailman ./bin/arch test
NOTE: you must move the directory out of the way, instead of simply copying it. If you don't do this, the arch command will add additional copies of previous messages to the existing archives and you will end up with duplicates.
Or you can use the --wipe option with ~mailman/bin/arch to initialize rather than add to the existing archive. See ~mailman/bin/arch --help
To make sure it worked, visit the list archive with your web browser. Once you're sure it's fine, you can delete the "test.save" directory.
CAVEAT: If you delete entire messages from the archive two side effects occur:
- Threading may be broken - if C is In-Reply-To: B which is In-Reply-To: A, and B is deleted, C will no longer be threaded with A.
- Messages will be renumbered - this may be important if there are saved links to archive messages. Since the message number is part of the URI, the saved link will no longer work or will retrieve the wrong message.
To avoid these problems, instead of deleting the entire message, leave the headers intact and replace the body with "Message deleted" or some other meaningful text.
NOTE ON HOW TO DELETE AN ENTIRE ARCHIVE:
- Browse to the list-administration panel, turn off archiving (option archive) and switch archive from public to private if it's public (option archive_private).
- Do the things as described above, when editing the raw archive (mbox), just delete all entries.
If you like to reenable archiving later, just turn on archiving in the list-administration panel (and set it to public if you like to).
NOTE ON PRUNING OLD MESSAGES:
There is a script at http://www.msapiro.net/scripts/prune_arch (mirrored at http://fog.ccsf.cc.ca.us/~msapiro/scripts/prune_arch) which can prune messages older than a specified number of days from the archives of one or more lists.
HOW TO DELETE A MESSAGE FROM THE HTML ARCHIVE ONLY
If you prefer, you can delete a message from the html archive only.
If the URL of the message is something like http://www.example.com/mailman/private/list/2008-February/024419.html (for a private archive) or http://www.example.com/pipermail/list/2008-February/024419.html (for a public archive), the archived message is the file ~mailman/archives/private/list/2008-February/024419.html.
You can simply remove that file, but that will leave broken links in the index pages and the 'next' and 'previous' links of neighboring messages. A better approach is to edit that file to remove what you don't want. Note however that if you don't edit the .mbox file, if you ever rebuild the archive, the original message will return.
Also, the message will remain in the web accessible periodic .txt and .txt.gz files unless you edit those too.
Converted from the Mailman FAQ Wizard
This is one of many Frequently Asked Questions.