cyradm and scripts

mb/cyrus at dcs.qmul.ac.uk mb/cyrus at dcs.qmul.ac.uk
Thu Sep 5 11:58:44 EDT 2002


At 11:25 -0400 Kiarna I Boyd wrote:

>Good Morning,
>
>I am trying to migrate an old perl script for mailbox management that
>used to work on the cyradm of 2.0.16 to the cyradm of 2.1.4.
>
>I've been reading the current manpages for cyradm but am having
>difficulty getting cyradm to accept scripts.
>
>Has any one had luck with this, and if so could you email me the flag
>for cyradm?

the perl modules should be easier than cyradm (though you can also find
a cyradm implementation in perl), something like:

#!/usr/bin/perl -I/usr/local/lib/perl5/site_perl/5.6.1/i386-linux

use strict;
use Cyrus::IMAP::Admin;

my $username = shift
        or die "need a username";

my $client = Cyrus::IMAP::Admin->new('imap.example.com')
        or die "aargh: Cyrus::IMAP error";

$client->authenticate(-user => 'cyrus', -password => 'not_telling')
        or die "authenticate: " . $client->error;

$client->create("user.$username")
        or warn "create: " . $client->error;

$client->setquota("user.$username", "STORAGE" => "200000")
        or die "setquota " . $client->error;

$client->create("user.$username.Sent")
        or die "createSent: " . $client->error;

$client->create("user.$username.Drafts")
        or die "createDrafts: " . $client->error;

$client->create("user.$username.Templates")
        or die "createTemplates: " . $client->error;

$client->create("user.$username.Probably-Spam")
        or die "createSpam: " . $client->error;






More information about the Info-cyrus mailing list