Patch for checking of default IMAP folders on logon.

Anders Karlsson (X:et) anders.x.karlsson at
Tue Feb 14 13:33:13 CET 2006

Hi everyone.

I've made a patch to let roundcube always look for the default IMAP  
folders needed(Sent / Trash ) when a user logs in.
This prevents roundcube from failing when sending mails if  
something / someone evil has removed those folders from the imap server.

Anyway here's the patch in unified diff format.

diff -Nru roundcubemail/program/include/ ../roundcubemail- 
--- roundcubemail/program/include/      2006-02-05  
17:34:48.000000000 +0100
+++ ../roundcubemail-cvs-20060205-modified/program/include/     2006-02-14 13:10:21.000000000 +0100
@@ -388,6 +388,17 @@
                  SET    last_login=now()
                  WHERE  user_id=?",
+       // Make sure that the default folders exists, if something  
evil has removed them we shall survive..
+    // get existing mailboxes
+       $a_mailboxes = $IMAP->list_mailboxes();
+       // check if the configured mailbox for sent messages exists
+       if ($CONFIG['sent_mbox'] && !in_array_nocase($CONFIG 
['sent_mbox'], $a_mailboxes))
+               $IMAP->create_mailbox($CONFIG['sent_mbox'], TRUE);
+       // check if the configured mailbox for sent messages exists
+       if ($CONFIG['trash_mbox'] && !in_array_nocase($CONFIG 
['trash_mbox'], $a_mailboxes))
+               $IMAP->create_mailbox($CONFIG['trash_mbox'], TRUE);
    // create new system user
    else if ($CONFIG['auto_create_user'])

Let me know if I should supply patches in another way / format


TDC Song
anders.x.karlsson at
CDTT (Certified Duct Tape Technician)

"Light travels faster than sound, thats why some people appear bright  
before they speak"

Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to  
bigger and better idiots. So far, the Universe is winning. - Rich Cook

More information about the Dev mailing list