Problem
I would like to establish forwarding via /etc/aliases such that all incoming mail messages to a particular account are stripped of attachments before delivery. Where I'm having a problem is what module(s) to use to accomplish it.
What I've tried
- Installed Mail-Tools, MIME-tools and IO::Stringy.
- Read the perldocs for MIME::Parser, MIME::ParserBase, and MIME::Entity.
- Written some test programs using Data::Dumper to try and understand the various "entity" structures.
- I've Super Searched the site and come up with some small snippets that glean a little information about using the above modules but nothing quite fits what I want to do.
I'm not asking for anyone to do this for me, just to give me some ideas on how to proceed.
For instance, will this strategy work:
- parse the incoming message via \*STDIN using MIME::Parser (?).
I gather this also decodes the message.
- delete references to unwanted attachments
- reassemble the message using MIME::Lite (?) and feed to STDOUT? Since I probably need to re-encode the message.
The main difficulty I think, is determining how the parts I need to delete are being referenced and how to insure that everything except the attachments gets forwarded. Am I overlooking some module that would simplify this task?
Thanks for any help, pointers.