> >
> > Some body did a patch to do auto create of mailboxes but I have lost the
> > URL ... I have the patch somewhere if it is required.
> >
> > --
> > Simon
>
> We have a patch (for 2.0.16 +) that provides the same
> functionality, in case a mail is posted to a user whose mailbox has not
> been created yet. This patch introduces a new boolean configuration
> option called "createonpost" through which admins can activate or
> deactivate this feature. This functionality for the time being applies
> only for user.<username> folders and not for BB or Subfolders
> (It would be possible though by applying some additional checks
> dependant on the mail service architecture, to address these cases too)
This patch ( attached) , only creates on login ..
its is from http://www.ispman.org/extras/
--
Simon
*** cyrus-imapd-2.0.11/imap/imapd.c Fri Jan 19 11:37:28 2001
--- imap/imapd.c Thu Feb 8 18:02:54 2001
***************
*** 2211,2217 ****
--- 2211,2224 ----
{
struct mailbox mailbox;
char mailboxname[MAX_MAILBOX_NAME+1];
+ char add_name[MAX_MAILBOX_NAME+1]; /* I'm not happy about this buffer, but
+ since "INBOX." can be no bigger than
+ "user.*", it *should* be okay. */
+ char add_mailboxname[MAX_MAILBOX_NAME+1];
+ char *autofolders;
+ char *autofolder;
int r = 0;
+ int r_tmp;
double usage;
int doclose = 0;
***************
*** 2231,2236 ****
--- 2238,2281 ----
if (!r) {
r = mailbox_open_header(mailboxname, imapd_authstate, &mailbox);
+ if (r == IMAP_MAILBOX_NONEXISTENT &&
+ !strncasecmp(name, "INBOX", 6) &&
+ config_getint("autocreatequota", 0)) { /* Autocreate INBOX */
+ r = mboxlist_createmailbox(mailboxname, MAILBOX_FORMAT_NORMAL,
+ NULL, 1, imapd_userid,
+ imapd_authstate);
+ if (!r) {
+ r = mailbox_open_header(mailboxname, imapd_authstate,
+ &mailbox);
+ }
+ r_tmp = r; /* Save return value for later */
+
+ if (!r) {
+ /* Deal with surreptitiously creating additional folders */
+ autofolders = strdup(config_getstring("autocreatefolders", ""));
+ autofolder = strtok(autofolders, " ");
+ while (autofolder != NULL) {
+ add_name[0] = '\0';
+ strcat(add_name, name);
+ strcat(add_name, ".");
+ strcat(add_name, autofolder);
+ r = mboxname_tointernal(add_name, imapd_userid, add_mailboxname);
+ if (!r) {
+ /* Throw away return because errors cannot be fatal and
+ there's no way to report them. syslog() maybe? */
+ (void)mboxlist_createmailbox(add_mailboxname,
+ MAILBOX_FORMAT_NORMAL,
+ NULL, 1, imapd_userid,
+ imapd_authstate);
+ }
+ /* I hope there are no intervening strtok()s */
+ autofolder = strtok(NULL, " ");
+ }
+ free(autofolders);
+ }
+
+ r = r_tmp; /* Replace ``original'' return value */
+ }
}
if (!r) {