This simple filter has proven to be MUCH harder to find than you’d think. There seem to be no management add-ons for Thunderbird in the same vein as those which permanently remove attachments. There are armies of old geeks in the forums, insisting that stripping HTML/MIME isn’t really what I want to do. You wouldn’t believe the lengths some have gone through to argue about it!
I finally settled on a couple of promising candidates here: http://www.perlmonks.org/?node_id=53404 and here: http://www.phred.org/~alex/stripmime.html I liked how short and sweet the script on perlmonks was, but it requires additional modules and seems to do less than stripmime. I found that I could cat a variety of multipart email messages, with and without attachments, through the stripmime script and it performed perfectly. Now, I just needed to hook it into the email account which is hosted on my Virtualmin server. The email account can be managed with Usermin, as it is a real Linux account.
Get The Script
First download the script here: http://www.phred.org/~alex/stripmime.pl If the website is down, I have verified that it is stored on archive.org. Place the script in the email account’s home directory. There may be better places for it, but I found this worked. Next, chmod +x stripmine.pl and then chown user:host stripmine.pl where “user” is the email username and “host” is the domain group. Other ownership attributes probably work, but these worked for me when root:root initially didn’t seem wise.
Next, go to the Webmin tab, Webmin settings, Usermin Configuration, Available Modules, and check Procmail Mail Filter to add this module to the Usermin interface.
Now return to Virtualmin, Select the domain which your email user is in, and select Edit Users. Select your email user and then click Login to Usermin.
Next to Mail, click the Usermin tab, and find “Procmail Mail Filter” in the list on the left (under Mail?). Click “Add a new filter action”. Set Delivery mode to “Feed to program” and enter the whole path and name leading to stripmine.pl Check “Action program is a filter” below and Save.
This produces a .procmailrc in the email account’s directory such as this:
Repeat as desired for each individual account you want stripped of HTML, MIME content and attachments. You can probably install this filter script systemwide, but this won’t usually be desireable.
When stripmime doesn’t find plain-text, but there is an HTML section, it attempts to reduce it to text. Stripmime also adds a report footer, which you can disable by commenting out at least lines 359-364.
Please comment if you recommend better file attributes, or even a better way to strip HTML/MIME/attachments. Stripmime is around 15 years old at the time of this posting, but still works like a charm!