Teach SpamAssassin from Junk and Inbox Maildir folders

I just run a small mail server for internal usage, but I wanted to test out with learning SpamAssasin some spam that I receive.
Here is my simple setup, I’m sure there are other ways to do it, but this is easy and fast to setup.
I use a MySQL database to hold my domains and users. If you don’t have those variables stored in MySQL, you can work around another way of looping through a root-folder or just set the paths hard coded in the script.