To address your issue I have configured this by using outlook account as a Guest user in my tenant. You can invite user as a Guest user in your tenant and he can get all his messages using GET https://graph.microsoft.com/v1.0/me/messages
Graph API endpoint(Please give all the required permissions before running this API). For more details please refer to this documentation. If you want to get messages from a particular user you can use https://graph.microsoft.com/v1.0/me/messages?$filter=from/emailAddress/address eq 'shivam@******.onmicrosoft.com'
.
You cannot use GET /users/{id | userPrincipalName}/messages
as it will give you "Resource could not be discovered." error for guest users.
Hope this helps,
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".