Diferencia entre revisiones de «Cyrus Imap»
De gacq wiki
Línea 5: | Línea 5: | ||
*[[Cyrus - Migrating from Courier-IMAP]] | *[[Cyrus - Migrating from Courier-IMAP]] | ||
*[[Cyrus - LDAP]] | *[[Cyrus - LDAP]] | ||
+ | = Python = | ||
+ | == Search and expunge a set of folders == | ||
+ | <pre> | ||
+ | import imaplib | ||
+ | |||
+ | imap = imaplib.IMAP4() | ||
+ | imap.login('manager', 'thepasswd') | ||
+ | |||
+ | for mbox in imap.list('', '*quotatest1*')[1]: | ||
+ | mailbox=mbox.split('"')[3] | ||
+ | imap.setacl(mailbox,'manager', 'lrswikxtecda') | ||
+ | print imap.select(mailbox) | ||
+ | print imap.expunge() | ||
+ | imap.setacl(mailbox,'manager', '') | ||
+ | |||
+ | </pre> | ||
= Util = | = Util = |
Revisión del 16:46 22 sep 2010
Contenido
Subpages
- Cyrus - Basic Configuration
- Cyrus - Exim4 configuration
- Cyrus - Sieve filtering
- Cyrus - Migrating from Courier-IMAP
- Cyrus - LDAP
Python
Search and expunge a set of folders
import imaplib imap = imaplib.IMAP4() imap.login('manager', 'thepasswd') for mbox in imap.list('', '*quotatest1*')[1]: mailbox=mbox.split('"')[3] imap.setacl(mailbox,'manager', 'lrswikxtecda') print imap.select(mailbox) print imap.expunge() imap.setacl(mailbox,'manager', '')
Util
Migrate mbolixt script
import fileinput for line in fileinput.input( "source-ctl_mboxlist-d" ): mailbox_end = line.find(".",5) if ( mailbox_end == -1 ): mailbox_end = line.find("\t",5) folder = "" else: folder = line[mailbox_end+1:line.find("\t",mailbox_end)] mailbox=line[5:mailbox_end] if folder: print "mailserver.gacq.com!user.%s.%s\t0 default %s@mailserver.gacq.com\tlrswipkxtecda\t" % (mailbox,folder,mailbox) else: print "mailserver.gacq.com!user.%s\t0 default %s@mailserver.gacq.com\tlrswipkxtecda\t" % (mailbox,mailbox)
Recreate cyrus spool and database folders
#rm -fr /var/spool/cyrus #rm -fr /var/lib/cyrus mkdir /var/spool/cyrus mkdir /var/lib/cyrus ./cyrus-makedirs --cleansquat chown -R cyrus:mail /var/spool/cyrus chown -R cyrus:mail /var/lib/cyrus