Checking for unread Gmail messages with the ruby-gmail gem

To check for unread Gmail messages gem install ruby-gmail and use the following code with your own Gmail account details:

require 'gmail'

gmail = Gmail.new("user@gmail.com", "password")
#=> #<Gmail:0xa98ba0 (user@gmail.com) disconnected>

gmail.inbox.count(:unread)
#=> 2

Tags:
Source:
1107hrs.txt
Published:
04-04-2013 11:07