|
Are there any Perl / cyrus imap experts around on
this list?
I have been trying to write a script to list all
the mail boxes, check if there is a linux
user for the box, and delete the un-used
boxes.
However no matter what I try I just get ARRAY
(ox82xxxxx) output instead of a text string.
Can anyone shed any light on what`s going
wrong?
I have attached my perl script as a text attachment
to avoid m$ messing up the line structure!
Thanks
Rob Keeling
|
#!/usr/bin/perl -w
my $adminuser = "cyrus" ;
my $adminpass = "password" ;
my $server = "localhost" ;
my $quota = 10*1024 ; # 10MB
my $user_uid_start = 500 ;
my $err = 0 ;
my $user = "";
my $lcuser = "";
use Cyrus::IMAP::Admin;
$imapcon = Cyrus::IMAP::Admin->new($server) || die "Unable to connect to $server";
unless ($imapcon) {
die "Error creating IMAP connection object\n" ;
}
$imapcon->authenticate(-user => $adminuser, -password => $adminpass, -mechanism => "LOGIN") ;
if ($imapcon->error) {
die $imapcon->error ;
}
print "start\n" ;
@mailboxes = $imapcon->list('user.rob*');
my $boxname;
my $mbox;
print "max records $#mailboxes \n";
foreach $mbox(@mailboxes) {
print ".";
print "$mbox\n";
}