here's something really simple i threw together, hope it helps. #!/usr/local/bin/perl -w # Really simple create mailbox script # by Steven Bloomfield - [EMAIL PROTECTED] # # This script only creates a new mailbox, I use MySQL for authentication # to execute from command line # perl /path/to/adduser.pl username # to execute within a PHP script # <?exec ("perl /path/to/adduser.pl ".$login);?> # I used $login as a variable passed from a form # To see this script in action visit http://mail.manchester.com # Thanks to david eitzinger for help with authenticating pam->mysql database
use Cyrus::IMAP::Admin; # hostname of IMAP server $server = "localhost"; # user and password for cyradm $user = "cyrususername"; $pass = "cyruspassword"; # Authenticate my $cyrus = Cyrus::IMAP::Admin->new($server); $cyrus->authenticate(-mechanism => 'login', -user => $user, -password => $pass); die $cyrus->error if $cyrus->error; $adduser = $ARGV[0]; $quota = "2000"; my $mbox = 'user.' . $adduser; # Create the account print STDERR "Creating $mbox on \n" if $debug; $cyrus->createmailbox($mbox); warn $cyrus->error if $cyrus->error; # Set the quota if ($quota) { print STDERR "Setting quota for $mbox to $quota\n" if $debug; $cyrus->setquota($mbox, 'STORAGE', $quota); warn $cyrus->error if $cyrus->error; } ----- Original Message ----- From: "Birger Toedtmann" <[EMAIL PROTECTED]> To: "Jeff Bert" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, March 08, 2002 4:30 PM Subject: Re: adding users via script Jeff Bert schrieb am Fri, Mar 08, 2002 at 08:02:44AM -0800: > I'm trying to find a script that will allow me to add users via a single > command line entry. > > I found "imapcreate.pl" at sourceforge but it seems to choke on every call > to the Cyrus::IMAP libraries. > > Has anyone done something like this or modified this perl script to work? I had this tiny one for testing, maybe you find it useful (but is perl as well and uses Cyrus::IMAP, so if they are broken, you're lost) Regards, Birger