Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

receiving email using NET::POP3.

by tenny1204 (Novice)
on Mar 01, 2013 at 06:48 UTC ( #1021163=perlquestion: print w/ replies, xml ) Need Help??
tenny1204 has asked for the wisdom of the Perl Monks concerning the following question:

Hi. The following program only works for email without attachment. Then i cannot retreive the message. The gmail server says: OK message follows, but the message never arrives. Can someone please tell me why?

use Net::POP3; use Net::POP3::SSLWrapper; pop3s{$pop3=Net::POP3->new('pop.gmail.com',Port=>995,Debug=>1) or die + "no pop\n"; if ($pop3->login('anmaat@gmail.com','******',)>0){ $msgs = $pop3->list; foreach $mes(keys %$msgs){ $top=$pop3->top($mes); $bo = $pop3->get($mes); foreach(@$top){ if($_=~/^(From|Subject)/){ print $_;} } $pop3->delete($mes); } $pop3->quit; } }

This example used to work, but now my connection keeps hanging. Does anyone know what it normally means if such a thing happens?

Comment on receiving email using NET::POP3.
Download Code
Re: receiving email using NET::POP3.
by Corion (Pope) on Mar 01, 2013 at 06:53 UTC

    What have you done to check whether the problem is with Google? If your code did work and you changed nothing at all, the problem must be with the other side.

    Personally, I would look at using the IMAP interface to Google, possibly using Net::IMAP::Client or one of the other IMAP client libraries.

      I will look into that module, thank you. But can you confirm that there really is nothing wrong with the code, because I dont have an emailadress with my internet provider to check if the problem is with Google. All i have are webmailadresses, all unreachable for my own programs last time I checked. thanks.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1021163]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2014-12-26 14:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls