List mailboxes

Patrick Boutilier boutilpj at ednet.ns.ca
Mon Oct 10 09:41:32 EDT 2011


On 10/10/2011 08:21 AM, Paul van der Vlis wrote:
> Hello,
>
> I would like to have a list with mailboxes, but I don't want all the
> submailboxes listed, and I don't want "hasNoChildren" etc.
> Is there a good way to do that?
>
> With regards,
> Paul.
>
>

This should work using the IMAP::Admin perl module. Using user.% just 
gives you top level mailboxes.




#!/usr/bin/perl -w
#
use IMAP::Admin;

# Fill in correct values for these username and password
$username = "";
$password = "";

# Set this to the hostname of your IMAP server
$IMAPSERVER = "localhost";

# Main Code
#
# Login to IMAP server
$imap = IMAP::Admin->new('Server' => $IMAPSERVER,
                          'Login' => $username,
                          'Password' => $password,) || die "no go $! !";

# List mailboxes
@list = $imap->list("user.%");
foreach (@list) {
   print "$_\n";
}

# Close connection
$imap->close;
exit;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: boutilpj.vcf
Type: text/x-vcard
Size: 286 bytes
Desc: not available
Url : http://lists.andrew.cmu.edu/pipermail/info-cyrus/attachments/20111010/5e735a6a/attachment.vcf 


More information about the Info-cyrus mailing list