<?php
$inbox = imap_open("{imap.gmail.com:993/imap/ssl}INBOX", "****@gmail.com", "*****", OP_HALFOPEN)
or die("can't connect: " . imap_last_error());
$check = imap_check($inbox);
print_r($check);
imap_close($inbox);
?>
o/p
stdClass Object ( [Date] => Tue, 8 Dec 2009 17:06:46 +0530 (India Standard Time) [Driver] => imap
[Mailbox] => {gmail-imap.l.google.com:993/imap/notls/ssl/user="****@gmail.com"} [Nmsgs] => 0
[Recent] => 0 )