Re: Checking for a mailbox's backend server

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

 



Perfect!  Thanks!

-Brenden

Andrew Morgan wrote:
On Tue, 19 Sep 2006, Brenden Conte wrote:

Is there a way to remotely find what backend server a specific mailbox is on using the admin account? This includes both users mailboxes as well as shared mailboxes.

##########################
# Locate which backend a mailbox is on
##########################
sub locatemailbox {
        my ($server, $authuser, $authpw, $mailbox) = @_;
        my $location = "";

        use Mail::IMAPClient;

        my $imap = Mail::IMAPClient->new(
                                Server => $server,
                                User => $authuser,
                                Password => $authpw
                        );
        if (! $imap) {
die("Cannot connect to mail server '$server' to locate mailbox - $!");
        }

my @results = $imap->tag_and_run(qq/GETANNOTATION $mailbox "*" "value.shared"/);

        $imap->logout;

        foreach my $r (@results) {
                $r =~ s/\r//g;
                $r =~ s/\n//g;
if ($r =~ /\/vendor\/cmu\/cyrus-imapd\/server" \("value.shared" "(.*)"\)$/) {
                        $location = $1;
                }
        }

        return $location;
}



    Andy



--
Brenden Conte
System Programmer, C&MT.CIO
Rensselaer Polytechnic Institute
(518)276-4264
----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

[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