Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to read mail using net::pop3...sees message, but fails to read

Status
Not open for further replies.

spewn

Programmer
May 7, 2001
1,034
hello!

here's my code:

Code:
$pop = Net::POP3->new( "pop.myserver.com" ) or die "Can't connect to pop.myserver.com: $!\n";

$username='myaccount@email.com';
$password='test2pass';

defined ($pop->login($username, $password));
defined ($pop->login());

%undeleted = $pop->list();
foreach $msgnum (keys %undeleted) {

print "Message $msgnum is $undeleted{$msgnum} bytes long.\n";

print "Retrieving $msgnum : ";
$message = $pop->get($msgnum);

 if ($message) {
 print "\n";
 print @$message;
 }
 else {
 print "failed ($!)\n";
 }

}

seems to find the message in there, but doesn't do anything more. here's the output:

Message is bytes long. Retrieving : failed ()

Seems to me that it finds the 1 email in the box or it wouldn't get to the "message is bytes" section, right?

i'm trying to pull all the info, from, subject, message, date and organize neatly...of course!

thanks.

- gus
 
I would think you'd get the number of bytes in there if it succeeded in finding an email. You don't have anything in there that would cause the code to abort before the "message is bytes..." print statment.
Try adding Debug => 1 to the constructor options per the documentation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top