本文簡介用perl 的Net::POP3 模組的使用.模組簡介請按此 功能為把目前自己信箱內的信件全部讀取出來,讀完之後便離開程式. 程式碼如下 範例下載
#!/usr/bin/perl ;
use Net::POP3;
my $hostname="";
my $username="";
my $password="";
$pop = Net::POP3->new($hostname);
$pop->login($username,$password);
my $msgnums = $pop->list; # hashref of msgnum => size
my $count =0 ;
foreach my $msgnum (keys %$msgnums)
{
my $msg = $pop->get($msgnum);
print @$msg; print "=" x 20 ;
print "\n"; $count=$count+1;
# $pop->delete($msgnum);
}
print "Mail number::$count\n" ; $pop->quit;
#!/usr/bin/perl ;
use Net::POP3;
my $hostname="";
my $username="";
my $password="";
$pop = Net::POP3->new($hostname);
$pop->login($username,$password);
my $msgnums = $pop->list; # hashref of msgnum => size
my $count =0 ;
foreach my $msgnum (keys %$msgnums)
{
my $msg = $pop->get($msgnum);
print @$msg; print "=" x 20 ;
print "\n"; $count=$count+1;
# $pop->delete($msgnum);
}
print "Mail number::$count\n" ; $pop->quit;
全站熱搜
留言列表