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.

Replies are listed 'Best First'.
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.