I am making an application which basically tells how many messages you received by a specific user. The only problem is that I don't know how to access inbox messages.

Is there any way to do that? I want all my messages in a list or something which I can use in my application.