Checking for a mailbox's backend server

Brenden Conte conteb at rpi.edu
Wed Sep 20 08:30:25 EDT 2006


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 



More information about the Info-cyrus mailing list