Just adding the solution here so the post can be marked as resolved:
Thanks everyone for your input, but we were able to resolve the error.
It seems like the issue was related to the VPN my company uses. It blocked access to the email gateway from the localhost. Once the VPN was turned off, the email connecter worked perfectly!