Read mails from gmail

For Each: Object reference not set to an instance of an object.

i am getting this error while running . using getIMAP messages

Disable for loop and check if messages is null or not or using - messages Is Nothing

showing invalid credentials

Share the screenshot of whole workflow