Last active
January 4, 2016 08:09
-
-
Save tsnow/8593683 to your computer and use it in GitHub Desktop.
Ruby script for Fourteen day count of gmail emails received
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'gmail' | |
require 'optparse' | |
puts "user: " | |
user = gets.chomp | |
puts "pass: " | |
pass = gets.chomp | |
dates = ((Date.today - 14)...Date.today) | |
Gmail.new(user,pass) do |gmail| | |
all_mail = gmail.mailbox('[Gmail]/All Mail') | |
dates.each do |i| | |
p [ | |
all_mail.count(:read, :on => i), | |
all_mail.count(:unread, :on => i), | |
all_mail.count(:on => i) | |
] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'ruby-gmail' | |
gem 'activesupport' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GEM | |
remote: https://rubygems.org/ | |
specs: | |
activesupport (4.0.2) | |
i18n (~> 0.6, >= 0.6.4) | |
minitest (~> 4.2) | |
multi_json (~> 1.3) | |
thread_safe (~> 0.1) | |
tzinfo (~> 0.3.37) | |
atomic (1.1.14) | |
i18n (0.6.9) | |
mail (2.5.4) | |
mime-types (~> 1.16) | |
treetop (~> 1.4.8) | |
mime (0.2.0) | |
mime-types (1.25.1) | |
minitest (4.7.5) | |
multi_json (1.8.4) | |
polyglot (0.3.3) | |
ruby-gmail (0.3.0) | |
mail (>= 2.2.1) | |
mime (>= 0.1) | |
shared-mime-info | |
shared-mime-info (0.2.5) | |
thread_safe (0.1.3) | |
atomic | |
treetop (1.4.15) | |
polyglot | |
polyglot (>= 0.3.1) | |
tzinfo (0.3.38) | |
PLATFORMS | |
ruby | |
DEPENDENCIES | |
activesupport | |
ruby-gmail |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@anachronistic
That's a fourteen day count starting two weeks ago. The format is:
[read, unread, total]
It doesn't play nice with two-factor, you might have to make a one time password for it.