php and cyrus

Veigar Freyr Jökulsson veigar at tviund.is
Mon Nov 25 19:40:42 EST 2002


> Hi-
> Does anyone know if there is a way to create a cyrus user and mailboxes
> through php?  I've looked around at imap_createmailbox() but am unlcear on
> how to use it.  Thanks!!
> -Greg
>

You could do something like this, $uid is the login name you want to create:

        $IMAPhost = "123.123.123.123";
        $IMAPquota = "10240",
        $username = "cyrus";
        $password = "password";
        $imapconn = imap_open("{" . $IMAPhost . "}", "$username",
"$password",OP_HALFOPEN);
        if ($imapconn) {
                imap_createmailbox($imapconn, "{" . $IMAPhost .
"}user.".$uid ) or die("can't connect: ".imap_last_error());
                imap_set_quota($imapconn, "user.$uid", $IMAPquota) or
die("can't connect: ".imap_last_error());
        imap_close($imapconn);
        }


--
Veigar Freyr Jökulsson
veigar at tviund.is





More information about the Info-cyrus mailing list