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

Hi.

I'm using the ThinMailer web based email application (http://www.oakbox.com/scripts/).

It's a great script, but, unfortunately, it doesn't include attachment support.

Does anyone know if there's a module I can add-on to it, so that I can process attachments from incoming emails?

Thanks,
Ralph.

Replies are listed 'Best First'.
Re: Read Email Attachments
by vladb (Vicar) on May 17, 2002 at 12:28 UTC
    You can use either MIME::Lite or MIME::Parser to retrieve email attachments. In fact, a program doing just that has already been written and posted to PerlMonks some time ago.

    Here's the node:

    MIME Attachment Extractor

    You may refer at the code for some concrete examples on how to implement the mentioned modules in your particular program in order for you to be able to extract your email attachments.

    Cheers.

    UPDATE: thanks Joost, I shouldn't have mentioned MIME::Lite. However, MIME::Parse may still do a perfect job ;-)

    _____________________
    $"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/;$_=&#91"ps -e -o pid | "," $2 | "," -v "," "]`@$_`?{print" ++ $1"}:{print"- $1"}&&`rm $1`;print"\n";}
      From the MIME::Lite manpage:

      ...MIME::Lite is intended as a simple, standalone module for generating (not parsing!) MIME messages...

      Use MIME::Tools (which contains MIME::Parser)

      -- Joost downtime n. The period during which a system is error-free and immune from user input.
Re: Read Email Attachments
by Joost (Canon) on May 17, 2002 at 12:27 UTC
    Take a look at MIME::Tools at cpan.org, it should do pretty much what you want.

    -- Joost downtime n. The period during which a system is error-free and immune from user input.