I'm not running into a problem or anything, I was just curious about this when I saw I have 2 folders with around 20,000 items in each. Everything works fine (using Thunderbird), but I couldn't find anything with Google about this. Anyone ever heard of a limit on this with Courier IMAP?
It depends on the file system:
In Linux, the limits are based on the number of inodes and the size of the drive. Note that ext2/ext3 and others that use the standard inode directory layout have a limit of ~32,000 sub directories in a directory.
For 20,000 files, use a file system that stores files in a tree structure, rather than the list structure as used by ext2/ext3, UFS, FAT16/FAT32. You might also want to increase the size of the directory cache.
AFAIK there's no limit of mails per IMAP folder in Courier IMAP or the IMAP4rev1 specification.
But the underlying file system on which the Maildir files are hosted could have a hard limit for the number of files per directory or at least may suffer performance degradation if a certain number of files in a single directory is exceeded.
20,000 mails/files should not be a problem, though.
Just for other people's information here. I run an e-mail host and I've seen inboxes and mail folders with over a million messages in them. Granted, they are really slow and it causes other issues at that point with just loading the folder, but it will work eventually. I usually call people out after their inbox grows past 40,000 messages or so.