Look and learn from excisting code
I learn by looking at code already used and alternate it as I would like to use it. I tried also to find out how something is working.
You might to look into the file /usr/local/ispconfig/server/plugins-enabled/mail_plugin.inc.php as Till stated and see how the Sent, Junk and Drafts folders are created. I will do the same.