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

I have a client that wants to automate the job of opening an IMAP$ mailbox, reading new e-mails and saving the e-mail's attachments to a directory.

I am able to authenticate to the server and read the emails, however, I have been unable to ascertain how to retrieve the attachments names and files. I know it is possible as every e-mail client does this. I can see the content-type and it has the following (see below), which is where I suspect the attachment file names are but I am unable to hash it out

boundary="Boundary_(ID_qCU3U6ck3QtxEAK8nvl/gg)"

Any insight would be greatly appreciated.

Rhonda
rjhughlett@home.com

Replies are listed 'Best First'.
Re: Email Attachments
by projekt21 (Friar) on Oct 09, 2001 at 19:57 UTC

    DO USE the MIME-tools package!!!! Please feel discouraged to parse Mime Attachments by yourself.

    see MIME::Parser and Email STDIN.

    alex pleiner <alex@zeitform.de>
    zeitform Internet Dienste

Re: Email Attachments
by davorg (Chancellor) on Oct 09, 2001 at 19:59 UTC

    Please don't go round reinventing things for no good reason. The MIME-tools bundle of modules contains everything that you'll need.

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you don't talk about Perl club."

Re: Email Attachments
by ronzomckelvey (Acolyte) on Oct 24, 2001 at 08:32 UTC
    Hi..

    I love perl, but I grew up on shell scripts. I have some interfaces that pull mail, extract the attachments then move them to another directory.

    I used a python script getmail.py (freshmeat) and
    uudeview -i +e dat -o *

    which would extract attachments from all files in the current dir..

    good luck