Hopefully this will help some future searchers. After the last iPhone update all the folders in my cPanel / Courier IMAP account started showing up in the Mail app, but I could not select them or move mail to them. I’d get an error like “mailbox does not exist” even though some part of the iPhone knew it did because it could see them. I Googled around and found that if you go to Settings > Mail > firstname.lastname@example.org > Advanced you could set an IMAP prefix to get everything working.
So I did, but nothing changed. However I deleted the account, reset it (hold down the top button), added the account back, set the prefix, reset again, and then all the folders started working. The advice I found worked, but there was some setting stuck somewhere that needed to be flushed out. Being able to file messages and read other folders from my iPhone is amazing. I was on the fence about the utility of the iPhone before, now I’m completely sold. It’s actually more fun than doing it in Thunderbird.