Hi Experts,
For ages I've been trying to work out how to use Perl to extract and save:
- Email attachments, and
- Email bodies
as files, and have had some joy with attachments, using the first script in the question part of this:
www.experts-exchange.com/Programming/Languages/Scripting/Perl/Q_20663126.html but it didn't work with some (even simple) emails, so I'd like to start from scratch.
Let's say the email will be STDIN for the Perl script. I'd like to:
1. Decode and save email attachments as files.
2. Save email bodies.
For extra points, it would be nice to be able to:
3. Do the above recursively (eg: when emails are forwarded as attachments).
4. Save all bodies as plain text (even if they were sent as HTML).
I've had a look at various Perl modules (eg: MIME::Parser, MIME::Entity, MIME::Tools, MIME::Body, etc), but haven't been able to work this out so far, so your help would be appreciated.
Thanks.