You tried to do some error checking after you tried to perform the operation
if ($gmail->error()) { print $gmail->error_msg(); }
I found that when I do this, this leads to:
Error: Failed to log in with these credentials - Could not find the final URL Also, HTTP error: 200 OK Error: Failed to log in.
I believe that this may be because the last module was updated in 2006, and gmail may have changed the way logins work so that it can no longer access it.
What could you do if you don't want to download new messages using pop3, you can use Net :: IMAP :: Simple to access your gmail account via IMAP
source share