Error handling for gmail_login and gmail_logout - IMAP throws errors at anything that moves.