1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-17 00:02:29 +01:00
imapsync/W/learn/imapclient_skeleton
Nick Bebout b7c835d670 1.670
2015-12-03 11:16:32 -06:00

28 lines
557 B
Perl

#!/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];
$folder_arg = $ARGV[3];
my $imap = Mail::IMAPClient->new();
$imap->Debug(1);
$imap->Server($host);
$imap->connect() or die;
$imap->IsUnconnected();
$imap->User($user);
$imap->Password($password);
$imap->login() or die;
$imap->Uid(1);
$imap->Peek(1);
my @folders = $imap->folders( ) ;
foreach my $folder ( @folders ) {
print "$folder\n" ;
}
$imap->select( $folder_arg ) or die ;
$imap->logout();