maylin has asked for the wisdom of the Perl Monks concerning the following question:

Hope some experts on Perlmonks can help me on this - If you have an Outlook email that includes an attached email, how can you use Perl to read/parse that embedded email? I tried to use WIN32::OLE, and I know you can get the mail body this way: $mailbody=$folder->Items->Item($i)->Body; Now this email also has an attached email and I need to get its mail body. So I used following line to get the attached email: my $attach = $folder->Items->Item($i)->Attachments(); After this line runs the $attach is that embedded email (and I can save the $attach to a text file), but how to open it to get its email body? I tried following but none of them worked: $mailbody=$attach->Body; # not working $mailbody=$attach->Items->Item(1)->Body; # not working $mailbody = $folder->Items->Item($i)->Attachments()->Body; # not working It'll be highly appreciated if somebody tells me where is wrong or where to find some sample codes.

Replies are listed 'Best First'.
Re: Perl to read attached Outlook email?
by tokpela (Chaplain) on Oct 29, 2009 at 17:17 UTC
Re: Perl to read attached Outlook email?
by keszler (Priest) on Oct 29, 2009 at 16:22 UTC
    It's been a few years since I last had to deal with Microsoftian email, but I recall needing Convert::TNEF.
      There's also TNEF and YTNEF, both of which have had more recent updates than Convert-TNEF (the TNEF format has evolved, and I haven't kept up with it in Convert::TNEF). But any of those is more useful on non-Windows systems (where you have no Windows API), and since the OP says he's using Win32::OLE, there really should be an OLE way of getting to the information he needs.