Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
more useful options
 
PerlMonks  

RE: MIME Attachment Extractor

by Punto (Scribe)
on Jun 01, 2000 at 15:26 UTC ( [id://15841]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to MIME Attachment Extractor

I have 1 question: if the e-mail has only 1 part (the body of the msg), the .doc file is created, @parts is empty, and the file never gets deleted on the "for $part (@parts)" loop. Is there a way to get the name of the file when there are no attachments?

Replies are listed 'Best First'.
RE: RE: MIME Attachment Extractor
by httptech (Chaplain) on Jun 01, 2000 at 15:41 UTC
    Yes, the bodies are always saved with the prefix "msg-" (unless you override it). So you can just unlink anything that starts with that prefix to clean out the message bodies.
      What if while I'm deleting, another program is creating a file, and it's not done with it yet? The module Mime::Parse may lock the file, but then the sub open the file..
RE: RE: MIME Attachment Extractor
by Punto (Scribe) on Jun 01, 2000 at 18:09 UTC
    I got it! :)
    Instead of using:
    $content .= $body->as_string if defined $body;
    I do:
    if (defined $body) { $content .= $body->as_string; $filename = $body->path; unlink($filename); };
    and it works fine.. Thanks..

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://15841]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.