Running a Mailman mailing list can generate a large number of archives over time, especially on busy servers. If you're managing your mailing lists through cPanel and want to clean up old data — whether for privacy, organization, or storage optimization — you can delete Mailman archives directly via the command line.
This guide will walk you through the step-by-step process to remove Mailman archives safely on a cPanel server.
Steps to Delete Mailman Archives via CLI
If you have created a Mailman mailing list called [email protected] and want to clear its archives, follow the steps below:
Step 1: Navigate to the Mailman Archives Directory
# cd /usr/local/cpanel/3rdparty/mailman/archives/private
Step 2: Identify Your Mailing List Archive Directory. You'll see several directories representing each mailing list. For example:
drwxr-x--- 2 mailman nobody 4.0K Jan 10 2019 mailman/ drwxrwx--- 2 mailman mailman 4.0K Jan 10 2019 mailman.mbox/ drwxr-x--- 2 mailman nobody 4.0K Oct 25 2019 mail_mailing.com/ drwxrwx--- 2 mailman mailman 4.0K Oct 25 2019 mail_mailing.com.mbox/ drwxr-x--- 2 mailman nobody 4.0K Oct 25 2019 listing_example.com/ drwxrwx--- 2 mailman mailman 4.0K Oct 25 2019 listing_example.mbox/
Step 3:Go to the Archive Directory for Your List
# cd listing_example.com
Step 4: List Archive Files to Confirm
# ls -alh
Step 5: Delete Specific Years’ Archives (e.g., 2019)
# rm 2019* -rf
Step 6:Clear Older Data, Like Database and Attachments (Optional). You can remove them using:
# rm -rf *
Step 7: Clear Mailman Cache. This ensures the UI reflects the deletions:
# /scripts/update_mailman_cache
Conclusion:
Cleaning up Mailman archives from your cPanel server is straightforward when done via the command line. Whether you're freeing up disk space, clearing outdated content, or doing general list maintenance, these steps help keep your server organized and efficient. Always double-check before running destructive commands, and back up important data if necessary.
