Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: receiving email message with an attachment.

by kennethk (Monsignor)
on Feb 27, 2013 at 15:55 UTC ( #1020915=note: print w/ replies, xml ) Need Help??


in reply to receiving email message with an attachment.

To expound upon Corion's point, you need to revise your conditional logic. What you probably mean is "If there is a body, then open it and output it." rather than "If there is no body, then bail." That could be written as

if ($body = $part->bodyhandle) { $IO=$body->open("r"); print while(defined($_= $IO->getline)); }

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re: receiving email message with an attachment.
Download Code
Re^2: receiving email message with an attachment.
by tenny1204 (Novice) on Feb 27, 2013 at 17:51 UTC

    what I mean is : Where is the body with the actual message? How do i get access to that? regards.

      Which module are you using? Have you tried reading its documentation? My guess is that you are using MIME::Parser and for your particular case, the first part has no body because it's a multipart. Have you tried checking the MIME type of your entity? See MIME::Entity#bodyhandle.

      #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      Where the body is depends on how the message is composed. Can you post a small but complete example of a message you are having trouble parsing?

        I red somewhere that all mime entities consisted of a (mime::)head and a (mime::)body, but apparently its not(entirely) true. I'll try some more on my own. Thank you.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020915]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2014-07-24 03:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (156 votes), past polls