Advertisement

05.14.2008 at 07:35PM PDT, ID: 23403838 | Points: 125
[x]
Attachment Details

Extract Email Body & Attachments

Tags: Larry Wall, Perl, 5, Perl, extract attachment body recursive perl
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.
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: tel2
Question Asked On: 05.14.2008
Participating Experts: 1
Points: 125
Views: 0
Translate:
Loading Advertisement...
05.15.2008 at 06:23AM PDT, ID: 21573277

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
06.30.2008 at 03:02AM PDT, ID: 21897807

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29 / EE_QW_2_20070628