I checked again the code and it worked well!! Now my question is if i can retreive the date that a message has been sent and the subject ,as well.
Thanks again! ----- Original Message ----- From: "Josimar Nunes de Oliveira" <[EMAIL PROTECTED]> To: "John" <[EMAIL PROTECTED]>; "Perl Beginners" <[EMAIL PROTECTED]> Sent: Wednesday, June 30, 2004 8:17 PM Subject: Re: Checking for Senders via POP3 > Hello John, > Try the same script with a few modification. > Good luck, > Josimar > > <code> > use Net::POP3; > > # > #my $pop = Net::POP3->new($host) or die "Couldn't connect: $!"; > #my $cnt; > #unless ( defined ( $cnt = $pop->login($user, $pw) ) ) { > # $pop->quit; > # die "Login error"; > #} > > #----here is the modification----------------------------------------------- > $host = 'yourmailserver.yourdomain'; > $user = '[EMAIL PROTECTED]'; > $pw = 'yourpassword'; > my $pop = Net::POP3->new($host, Timeout => 60) or die 'connect error'; > $pop->user($user) or die 'login error'; > my $cnt = $pop->pass($pw) or die 'authetication error'; > #--------------------------------------------------- > > if ($cnt > 0) { > for my $num ( sort { $a <=> $b } keys %{ $pop->list } ) { > print "Msg $num - ", grep /^From: /, @{ $pop->top($num) }; > } > } else { > print "No messages\n"; > } > $pop->quit; > > </code> > > > ----- Original Message ----- > From: "John" <[EMAIL PROTECTED]> > To: "Perl Beginners" <[EMAIL PROTECTED]> > Sent: Wednesday, June 30, 2004 12:13 PM > Subject: Re: Checking for Senders via POP3 > > > > Your script doesn't get connect to anywhere. (netstat -a says nothing) > > > > I give the correct host , username, password and it doesn't work. > > > > Is the module broken? Net::POP3 (i use it on win32 active's distribution) > > > > > > > > ----- Original Message ----- > > From: "Gunnar Hjalmarsson" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, June 30, 2004 5:55 PM > > Subject: Re: Checking for Senders via POP3 > > > > > > > John wrote: > > > > I want to check for specific senders (in my inbox) connecting to > > > > the Mail Server via POP3.(just checking the From : bla bla string) > > > > Not to download the inbox mails to my system. > > > > > > This is one way: > > > > > > use Net::POP3; > > > my $pop = Net::POP3->new($host) or die "Couldn't connect: $!"; > > > my $cnt; > > > unless ( defined ( $cnt = $pop->login($user, $pw) ) ) { > > > $pop->quit; > > > die "Login error"; > > > } > > > if ($cnt > 0) { > > > for my $num ( sort { $a <=> $b } keys %{ $pop->list } ) { > > > print "Msg $num - ", grep /^From: /, @{ $pop->top($num) }; > > > } > > > } else { > > > print "No messages\n"; > > > } > > > $pop->quit; > > > > > > I for one did not receive the result of your efforts so far. Maybe you > > > forgot to paste it into the message you sent... > > > > > > -- > > > Gunnar Hjalmarsson > > > Email: http://www.gunnar.cc/cgi-bin/contact.pl > > > > > > -- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > > > > > > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > > > > > > > > ----- Original Message ----- > From: "John" <[EMAIL PROTECTED]> > To: "Perl Beginners" <[EMAIL PROTECTED]> > Sent: Wednesday, June 30, 2004 12:13 PM > Subject: Re: Checking for Senders via POP3 > > > > Your script doesn't get connect to anywhere. (netstat -a says nothing) > > > > I give the correct host , username, password and it doesn't work. > > > > Is the module broken? Net::POP3 (i use it on win32 active's distribution) > > > > > > > > ----- Original Message ----- > > From: "Gunnar Hjalmarsson" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, June 30, 2004 5:55 PM > > Subject: Re: Checking for Senders via POP3 > > > > > > > John wrote: > > > > I want to check for specific senders (in my inbox) connecting to > > > > the Mail Server via POP3.(just checking the From : bla bla string) > > > > Not to download the inbox mails to my system. > > > > > > This is one way: > > > > > > use Net::POP3; > > > my $pop = Net::POP3->new($host) or die "Couldn't connect: $!"; > > > my $cnt; > > > unless ( defined ( $cnt = $pop->login($user, $pw) ) ) { > > > $pop->quit; > > > die "Login error"; > > > } > > > if ($cnt > 0) { > > > for my $num ( sort { $a <=> $b } keys %{ $pop->list } ) { > > > print "Msg $num - ", grep /^From: /, @{ $pop->top($num) }; > > > } > > > } else { > > > print "No messages\n"; > > > } > > > $pop->quit; > > > > > > I for one did not receive the result of your efforts so far. Maybe you > > > forgot to paste it into the message you sent... > > > > > > -- > > > Gunnar Hjalmarsson > > > Email: http://www.gunnar.cc/cgi-bin/contact.pl > > > > > > -- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > > > > > > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > > > > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>