in reply to Using Net::IMAP::Simple to read emails

The problem is that you're looking for a line that starts with "Body:" and you're not going to find one. Try printing out each line as you process it. After all the header fields, there are two newlines and then the body just starts--there's no tag identifying it.

You might want to use Email::Simple to handle the parsing of the email message. The example in the Net::IMAP::Simple perldoc uses it.

-b

  • Comment on Re: Using Net::IMAP::Simple to read emails

Replies are listed 'Best First'.
Re^2: Using Net::IMAP::Simple to read emails
by Anonymous Monk on Dec 22, 2004 at 21:23 UTC
    hi bgreenlee, you are right. there is no tyg identifiying for body. i liked to know how to use the Email::Simple to getting any field from the email. The code below bring not any value:
    foreach my $msg( 1 .. $number_of_messages ) { my $email = Email::Simple->new( join '', @{$server->get( $msg +)} ); print $email->header('Subject'), "\n"; }

      I'm not sure what the problem is. I just tried it out myself and it worked fine. Try either stepping through it with the perl debugger (have a look at perldebug and perldebtut if you're not familiar with it), or using Data::Dump to dump out the value of $email. And make sure you use strict and use warnings.

      -b

        i dont know, whats happen but i got everytime blank-page!