Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: receiving email message with an attachment.

by kennethk (Abbot)
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.

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020915]
help
Chatterbox?
[Discipulus]: choroba if let your company to hire Tanktalus and marioroy ... what a big fishing!
[Discipulus]: i choice prague!!
[choroba]: 1200 years is enough :-)
[marioroy]: Lady_Aleena my $ans = qx! find . -name "*.pl" -exec ls -l {} \\; !;
[Tanktalus]: My basic problem right now is that if I were willing to move, I could be back in Toronto with a pay raise. We have a number of reasons for not wanting to do that.
[marioroy]: I had to backslash the backslash inside qx.
[Tanktalus]: marioroy++ # nice catch
[Lady_Aleena]: marioroy, that makes kinda makes sense.
[Discipulus]: yes i can survive also in younger town.. but when i passed i saw many strange letters..
[Lady_Aleena]: marioroy, sorry, I am not making sense right now.

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2017-04-23 20:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.