Reputation: 23737
How can I check the number of unread Gmail message in my inbox with a short Ruby script?
Upvotes: 3
Views: 1854
Reputation: 11
Nash's solution worked for me once I added require 'rubygems'
as the first step.
Before I did that I would get the following error when using require 'gmail'
.
LoadError: no such file to load -- gmail
Upvotes: 1
Reputation: 24617
Use ruby-gmail
gem install ruby-gmail mime
irb(main):001:0> require 'gmail'
=> true
irb(main):002:0> gmail = Gmail.new("[email protected]", "password")
=> #<Gmail:0x1ea65d8 ([email protected]) disconnected>
irb(main):004:0> gmail.inbox.count(:unread)
=> 42
Upvotes: 4