scripted delete mailbox for cyradm

Nikola Milutinovic Nikola.Milutinovic at ev.co.yu
Fri Feb 11 01:25:08 EST 2005


Aleksandar Milivojevic wrote:

> Craig White wrote:
>
>> Trying to script deleting a user's mailbox from system...
>>
>> /bin/su - cyrus -c '/usr/lib/cyrus-imapd/cyradm localhost \ 
>> --userrc=/var/lib/imap/.systemrc dm user.public'
>
>
> Try something like this instead:
>
> #! /usr/bin/perl -w
>
> use Cyrus::IMAP::Admin;
>
> $imap = Cyrus::IMAP::Admin->new("servername")
>    or die "Failed to connect";
> $imap->authenticate("-user" => "username",
>                     "-password" => "password",
>                     "-mechanism" => "LOGIN")
>    or die "Failed to authenticate";
> $imap->delete("user.mailbox")
>    or die "Failed to delete mailbox";
>
> See man pages for Cyrus::IMAP::Admin and Cyrus::IMAP for more details.


One thing worth noting, in order to delete a mailbox, one must have "c" 
permission on it. Admins, by default, do not have it. You must first 
"sam <mailbox> <admin> c", then "dm user.mailbox".

Nix.
---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html




More information about the Info-cyrus mailing list