Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: email parsing problem?

by holo (Monk)
on Dec 10, 2003 at 15:12 UTC ( [id://313843]=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 email parsing problem?

You are parsing data incorrectly (try long lines or lines starting with "--" to get a bunch of email-control characters.

Use Mail::Message to get attachments out of the email and manipulate mime types better.

use Mail::Message; my $fromline = <STDIN>; my $msg = Mail::Message->read(\*STDIN); if($msg->isMultipart) { for($msg->body->parts) { open(my $tofile,">/tmp/filename") or die "Error opening tmpfile: $!"; $_->print($tofile); close $tofile; # print } }

As you might guess, multiple attachments are also handled correctly.

Replies are listed 'Best First'.
Re: Re: email parsing problem?
by Octavian (Monk) on Dec 10, 2003 at 15:35 UTC
    That looks like a pretty good idea, we dont have Mail::Message installed though...so its not gonna help..I will see about getting that module, but making a change to our version of perl takes forever (yes, I work for the government)
    the only related modules we do have are (I searched for MIME and Mail):
    MIME::Base64 MIME::QuotedPrint Mail::Sender
      *sigh* I work for an extension of a State government. I feel your pain.

      At times like this, the adage "it's easier to apologize than get permission" might serve you well. YMMV.

      If things get any worse, I'll have to ask you to stop helping me.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://313843]
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.