We would need more information about your servers to be able to troubleshoot this properly.
As a general help you should check your php logs and see if there are any errors being reported there.
You should also check your mail servers logs to see if there are any errors being reported there.
Also make sure your PHP is compiled with IMAP enabled, or in case of a windows server that the php_imap.dll extension is being loaded in the php.ini. You can check this by creating a test.php on your webserver and putting the following code into the file:
<?php
phpinfo();
?>
Then open your site/test.php. Make sure that you delete this file when you are done with it.