subscribing for a user
Luca Olivetti
luca at wetron.es
Sat Jul 19 14:32:57 EDT 2003
Phil Chambers wrote:
> I am still new to cyrus and trying to find my way. I have tries searching this list
> archive but could not find this issue.
>
> If I create a folder for a user using the Cyrus::IMAP::Admin perl module, is it
> possible to mark that folder as being one of the user's subscribed folders?
Hi, I use a simple python script for that, the only problem is it needs
to know the user password. This is no problem for me, since I use it
while creating the user and I just assigned him/her a random password.
The script creates the mailboxes and subscribes the user to them. Since
it also creates the user's INBOX you'll have to set to true the
autocreatequota option in /etc/imapd.conf.
The script accepts the username and the password as arguments and runs
in the same host as the server.
Hope it helps.
# Crea el buzon de usuario y suscribe a sent, plantillas, borradores
#
# Para que el usuario pueda crear su propio INBOX hace falta
# que autocreatequota en /etc/imapd.conf tenga valor distinto
# que 0
#
import imaplib
import sys
def createmb(user,password):
mailboxes=('sent','plantillas','borradores')
cyrus=imaplib.IMAP4()
cyrus.login(user,password)
cyrus.create('INBOX')
for mb in mailboxes:
cyrus.create('INBOX.'+mb)
cyrus.subscribe('INBOX.'+mb)
cyrus.logout
if __name__ == "__main__":
createmb(sys.argv[1],sys.argv[2])
--
Luca
More information about the Info-cyrus
mailing list