-----Original Message-----
From: awarsd [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 30, 2003 8:06 AM
To: [EMAIL PROTECTED]
Subject: Mime::Parser starter 


Hi,

i just need someone to guide me please
I'm retrieving from my host email(with attachment) using Net::Pop3
I print the message content- where we can see
Charsert ="iso-8869-1"
--- =_NextPart_001................
to, subject
etc....
now i see on the bottom of this message
Content-type: image/gif;
name = "image.gif";
content-trasfer-encodeing:base 64;
Content-disposition: attachment;
filename = "image.gif";

r01Gid1jhasdffsd897sdfa87dfas897asdfasdf #### A LONG CODE

My question is that should i retrieve this 'LONG CODE' Save it in a file or
save the entire message content where it has subject content-type etc.....?

thanx for any advice



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Hello,

you could, using Net::POP3 write the message out to a file and then using MIME::Parser 
parse each component such as:

$server = "mail_server";
$user = "account_name";
$pass = "password";
$pop = Net::Pop3->new($server) or die "Unable to connect to server $server: $!\n";
$pop->login($user, $pass) or die "unable to login with User: $user Pass; $pass $!\n";
@popstat = $pop-popstat();
if ($popstat[0] > 0) {
    $msgs = pop->list;
    foreach $msgid (keys %$msgs) {
        open(CURRMSG, ">currmsg.msg") or die "Cannot open message: $!\n";
        $pop->get($msgid, \*CURRMSG);
        close CURRMSG;
        $parser = new MIME::Parser;
        $parser->extract_nested_messages(1);
        $parser->parse_open("currmsg.msg") or die "Unable to parse message $msgid 
$!\n";
        # do something with message/parts

        # clean up
        unlink("currmsg.msg") or die "Unable to delete temp message: $!\n");
        $parser->filer->purge or die "Unable to delete message parts: $!\n";
    } # Move to next message or end if none left
}

Please do your homework and verify this as I have type it mainly off the top of my 
head. Also, it's important to familiarize yourself with the documentation for 
MIME::Parser and Net::POP3. There are a bunch off things you should do in terms of 
error checking and other coding before this is a usefull program. Don't use this as 
is! Always remember that there is more than one way to do it! 

Steve

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to