Question
How do I remove older mail archives for Mailman?
Answer
There is no automated way to handle this process; therefore, the changes must be made using the command line.
The following tasks should only be handled by Systems Administrator who is comfortable manipulating files using the command line. cPanel cannot directly assist with the steps in this article. Before making any changes, backup the folder you're making changes to.
Inside the /usr/local/cpanel/3rdparty/mailman/archives/private/ folder, the archives will be in folders with the list name, followed by an underscore and the domain name. Before proceeding, you should make a backup of the archives folder using the command structure below:
cp -Rav /usr/local/cpanel/3rdparty/mailman/archives/private/$LIST_$DOMAIN.tld.mbox/$LIST_$DOMAIN.tld.mbox $BACKUP_DESTINATION
The mailing list's archives are stored in a mbox file inside the /usr/local/cpanel/3rdparty/mailman/archives/private/$LIST_$DOMAIN.tld.mbox/$LIST_$DOMAIN.tld.mbox folder in text format.
- To remove entries, you need to open the mbox file with your preferred text editor and delete the message content you wish to erase from the archive. In this example, vim is used, but any command line editor can be used:
vim /usr/local/cpanel/3rdparty/mailman/archives/private/list_domain.tld.mbox/list_domain.tld.mbox
- After you have deleted content from the mbox file, the arch --wipe command is run to clear out any HTML data created from the archives. This command would not remove archives unless you removed messages in the previous step, as the data is built from the email files in the mbox file:
/usr/local/cpanel/3rdparty/mailman/bin/arch --wipe list_domain.tld