2011-03-12 03:44:47 +01:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
|
|
|
|
use Mail::IMAPClient;
|
|
|
|
|
|
|
|
$ARGV[3] or die "usage: $0 host user password folder\n";
|
|
|
|
|
|
|
|
$host = $ARGV[0];
|
|
|
|
$user = $ARGV[1];
|
|
|
|
$password = $ARGV[2];
|
2015-12-03 18:16:32 +01:00
|
|
|
$folder_arg = $ARGV[3];
|
2011-03-12 03:44:47 +01:00
|
|
|
|
|
|
|
my $imap = Mail::IMAPClient->new();
|
|
|
|
$imap->Debug(1);
|
|
|
|
$imap->Server($host);
|
|
|
|
$imap->connect() or die;
|
2011-03-12 03:45:02 +01:00
|
|
|
$imap->IsUnconnected();
|
2011-03-12 03:44:47 +01:00
|
|
|
$imap->User($user);
|
|
|
|
$imap->Password($password);
|
|
|
|
$imap->login() or die;
|
|
|
|
$imap->Uid(1);
|
|
|
|
$imap->Peek(1);
|
2015-12-03 18:16:32 +01:00
|
|
|
my @folders = $imap->folders( ) ;
|
|
|
|
foreach my $folder ( @folders ) {
|
|
|
|
print "$folder\n" ;
|
|
|
|
}
|
|
|
|
$imap->select( $folder_arg ) or die ;
|
2011-03-12 03:45:04 +01:00
|
|
|
$imap->logout();
|