Perl module interface

Mark Davis MDRobot at team.nwn.de
Sat Sep 21 16:36:10 EDT 2002


Hi.

Try it like that:

==================================================
#!/usr/bin/perl

use Cyrus::IMAP::Admin;

$server = "localhost";
$cyrus_admin_username = "admin_username";
$cyrus_admin_password = "admin_password";

$mbox = shift or die "usage: make_mailbox.pl <username> .";
$mbox = "user.$mbox";


# Authenticate
my $cyrus = Cyrus::IMAP::Admin->new($server);
$cyrus->authenticate(-mechanism => 'login', -user => $cyrus_admin_username, -password
=> $cyrus_admin_password);
die $cyrus->error if $cyrus->error;

# Create the account
print "Creating $mbox on \n";
$cyrus->createmailbox($mbox);
warn $cyrus->error if $cyrus->error;

# Finished :)
==================================================


Greets
Mark

----- Original Message -----
From: "matsu" <matsu at com56.com>
To: <info-cyrus at lists.andrew.cmu.edu>
Sent: Saturday, September 21, 2002 8:33 PM
Subject: Re: Perl module interface


> Thank you for your advise.
>
>
> Jim Levie <jim at entrophy-free.net> wrote @2002/09/22 3:11:18 title Re: Perl module
interface :
> > I suspect that you aren't sucessfully connecting to the Cyrus Admin
> > function. A slightly modified version of your script follows. Replace
> > 'cyrus' & 'cyruspw' with a Cyrus Admin username/password.
> I tried by this way, but I got this error.
> ------------------------------------------------
> $ ./make_mailbox.pl foo001
> Usage: Cyrus::IMAP::new(class, host = "localhost", port = 0, flags = 0) at /usr/
> lib/perl5/site_perl/5.6.0/i386-linux/Cyrus/IMAP/Admin.pm line 62.
> $
> ------------------------------------------------
>
> ------------------------------------------------
> > > ==================================================
> > > #!/usr/bin/perl
> > >
> > > #----------------------------
> > > # module
> > > #----------------------------
> > > use strict;
> > > use Cyrus::IMAP::Admin;
> > >
> > > # error print
> > > unless($ARGV[0]){ &usage(); }
> > >
> > > # $ARGV[0] is account name
> > > my $user_name = $ARGV[0];
> > >
> > > #----------------------------
> > > # program
> > > #----------------------------
> > > my ($client, $rc);
> > > $client = Cyrus::IMAP::Admin->new('Server'=>'localhost', 'Login'=>'cyrus',
> >                                     'Password'=>'cyruspw');
> > >
> > > ## create mailbox
> > > my $full_mailbox_name = 'user.'.$user_name;
> > > $client->create($full_mailbox_name);
> > >
> > >
> > > __END__
> > >
> > > ==================================================
> > >
>
>
> ---------------------------------
> Yuki Matsukura <matsu at com56.com>
>
> http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=0xC2E9FE2A
> ---------------------------------
>
>
>





More information about the Info-cyrus mailing list