Victor Duchovni a écrit : > On Wed, Feb 11, 2009 at 09:24:25PM +0100, mouss wrote: > >> post...@corwyn.net a ?crit : >>> And a last betterer/simpler way to do it. >>> >>> SELECT >>> if(INSTR(maildir,'+'),concat(left(maildir,instr(maildir,'+')-1),'/Maildir/.',right(maildir,length(maildir)-instr(maildir,'+'))),CONCAT(maildir,'Maildir/')) >>> from mailbox where username ='%s' and active='1' >> you are still allowing random folder names. > > That's what I thought at first, but now I am not so sure. Perhaps all > this string munging is based on an attribute from the table, not the > input address. It sems that the database does not hold mailbox paths, > and they are always constructed from the user name, with special logic > for user+spam user names. That's OK, provided the OP controls user > names. >
ah! indeed, he puts complete addresses in the mailbox table. This is too much work however, IMHO. using a "Folder" table would be better.