Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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('',Port=>995,Debug=>1) or die + "no pop\n"; if ($pop3->login('','******',)>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?

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

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1021163]
Front-paged by Arunbear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2018-03-21 15:29 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (268 votes). Check out past polls.