Yes, PHP's socket functions should be able to connect to an IMAP server...
They can be used to connect to just about any type of server... IF you know the protocl for the server. I also highly recommend using PHP 4.1.0+ because of its php_socket.dll/.so extension compared to the fsockopen() function type.
More info here:
http://www.php.net/manual/en/ref.sockets.php
-Josh B