completed getMessages function for all folders (therefor added parameters to define wanted folder)