Since you are using Client credential flow you need to use Application permissions on the Azure portal. Please add Mail.Send Application permission and it will work.
Remove ‘Me’ and add Users[‘Userid’] since ‘Me’ talks about the logged in user and we don’t have any user here.
Userid is the user object id in Azure AD. You can also use the userPrincipalname for testing. You can get the userid of a user by using /users endpoint and filter with displayname or userPrincipalname.
CLICK HERE to find out more related problems solutions.