Powershell script with Get IMAP mail messages activity is giving "Timed out while waiting for Mail service to connect. "

HI
I ran the Powershell script which worked fine.
but the same settings with Get IMAP mail messages activity is giving out "Timed out while waiting for Mail service to connect. "

Please suggest.

Thanks