I'm trying to add some subfolders during the creation of users, but the problem (from what I'm seeing) seems to be that the welcome email takes a second or two too long to go through the system, and the imap command to chdir doesn't find the directory in time..
By the time I can find the error, the directory exists, unless the problem is that the base directory of courier isn't what imapd thinks it is (the chdir follows the /firstname.lastname@example.org/ format, should it be trying the entire path /email@example.com/ ?).
I'm of the opinion that the problem is the slowness, if I could double the wait I'm pretty sure the problem would resolve itself..
Is there an option I can change, or do I need to edit the relevant php file?
Well, to let anyone who might want to know how to fix this problem, there's a line sleep(1); in the functions.inc.php file (the section "create_mailbox_subfolders"), just add some time to it, I have it sleep for 6 seconds, and it resolved my problem…
You found the correct place to edit (it's not a $CONF option until now).
However I'm more than surprised that you need a sleep(6) - this would indicate a *very* slow mailserver. Are the 6 seconds really needed or is it just "well, I need more than one, let's try 6"? ;-)
(Thinking about it, maybe I can implement a "smart" delay that uses sleep(1), but tries X times after another sleep(1)…)