|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Member
Iscritto dal: Jul 2007
Messaggi: 45
|
Perl e imap .. problemi
Salve, sto cercando di ricavare le nuove email non lette da gmail con perl, il codice è questo:
Codice:
#!/usr/bin/perl use strict; use Mail::IMAPClient; use IO::Socket::SSL; my $username = 'myemail@gmail.com'; my $password = 'mypasswd'; my $socket = IO::Socket::SSL->new( PeerAddr => 'gmail-imap.l.google.com', PeerPort => 993 ) or die "socket(): $@"; my $client = Mail::IMAPClient->new( Socket => $socket, User => $username, Password => $password, Uid => 1, ) or die "new(): $@"; if ($client->IsAuthenticated()) { my $msgct; $client->select("INBOX"); $msgct = $client->unseen_count||'0'; print "Email unread: $msgct\n"; my @unread = $client->unseen or warn "Could not find unseen msgs: $@\n"; foreach (@unread) { print "$@\n"; print $_ . " - " . $client->fetch($_) . "\n"; } } $client->logout(); Codice:
king@homepc:~$ ./script.pl Email unread: 3 12730 - 5 BAD Could not parse command 12740 - 6 BAD Could not parse command 12746 - 7 BAD Could not parse command king@homepc:~$ ./script.pl Qualcuno sa darmi un consiglio ? |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Prova ad abilitare il flag di debug, cosi' si dovrebbero vedere i comandi scambiati col server
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 04:19.