cyrus_list.pl
#!/usr/bin/perl
use Cyrus::IMAP::Admin;
$server = 'localhost';
$adminuser = 'cyrus';
$adminpw = 'secret';
$imap = Cyrus::IMAP::Admin->new($server) || die "Unable to connect";
unless ($imap) {
die "Error creating IMAP Connection object\n";
}
$imap->authenticate(-user => $adminuser, -password => $adminpw, -mechanism => "LOGIN");
if ($imap->error) {
die $imap->error;
}
@list = $imap->list("*");
for $aref ( @list ) {
$mbox = @$aref[0];
($auser, $adomain) = split(/\@/, $mbox);
($a, $auser, $b) = split(/\//, $auser);
$has = @$aref[1];
if ($has eq "\\HasChildren") {
print "$auser","@","$adomain\n";
}
}
print "\n";
use Cyrus::IMAP::Admin;
$server = 'localhost';
$adminuser = 'cyrus';
$adminpw = 'secret';
$imap = Cyrus::IMAP::Admin->new($server) || die "Unable to connect";
unless ($imap) {
die "Error creating IMAP Connection object\n";
}
$imap->authenticate(-user => $adminuser, -password => $adminpw, -mechanism => "LOGIN");
if ($imap->error) {
die $imap->error;
}
@list = $imap->list("*");
for $aref ( @list ) {
$mbox = @$aref[0];
($auser, $adomain) = split(/\@/, $mbox);
($a, $auser, $b) = split(/\//, $auser);
$has = @$aref[1];
if ($has eq "\\HasChildren") {
print "$auser","@","$adomain\n";
}
}
print "\n";
There are no comments on this page. [Add comment]