Re: List mailboxes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
begin:vcard
fn:Patrick Boutilier
n:Boutilier;Patrick
org:;Nova Scotia Department of Education
adr:;;2021 Brunswick Street;Halifax;NS;B3K 2Y5;Canada
email;internet:boutilpj@xxxxxxxxxxx
title:WAN Communications Specialist
tel;work:902-424-6800
tel;fax:902-424-0874
version:2.1
end:vcard

----
Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]
  Powered by Linux