This requires you to have imap support compiled with php, you might have pop3 access to your site but it also might not have imap support as well. So if you get a error like imap_open undefined function, then you dont have imap support.
Theres a way to access a pop3 mail server without using Imap compiled with php using fsocket, I use a online mail script that connects to pop3 using fsocket instead of imap because I dont have Imap compiled.
For more ifo on imap go here:
http://www.php.net/manual/en/ref.imap.php