MySQL Grouping Data Together From Same User
If I'm following, you want to have one panel per user the current user has exchanged messages with, and show all messages from that person in that panel.

To get all people the current user has received messages from (broken into multiple lines for readability - you can put it in one line in your code):

SELECT SenderID, ProfileName
  FROM ve_messages m JOIN ve_users u ON m.SenderID=u.UserID
 WHERE m.RecieverID= '$loginid_session'
 GROUP BY UserId, ProfileName
;


Loop through these results to create your panels.

You'll need a second loop within each panel to show each message, using the results of this query:

SELECT *
  FROM ve_messages m JOIN ve_users u ON m.SenderID=u.UserID
 WHERE m.RecieverID= '$loginid_session'
   AND m.SenderID = {$inbox['SenderID']}
 ORDER BY SentOn DESC
;


You may actually want to change the name of the $inbox associative array, as it now just has the ID and profile names of senders.

The ORDER BY assumes that you'd want the most recent messages at the top; change DESC to ASC to flip that.