Created
June 28, 2011 15:08
-
-
Save edelbalso/1051342 to your computer and use it in GitHub Desktop.
Cleaning your inbox, the ruby way.
This file contains hidden or 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/ruby | |
require 'rubygems' | |
require 'gmail' | |
def mailinate(label,emails, delete_email = false) | |
puts "#{label} [#{emails.count}]" | |
emails.each do |email| | |
puts " #{delete_email ? 'assasinating' : 'mailinating'} => [#{email.subject}]" | |
email.mark(:read) | |
email.label('mailinated') | |
if delete_email | |
email.delete! | |
else | |
email.archive! | |
end | |
end | |
end | |
print "enter email: " | |
user = gets.strip | |
print "enter password: " | |
pw = gets.strip | |
Gmail.new(user,pw) do |gmail| | |
mailinate('Groupon',gmail.inbox.emails(:from => '[email protected]') ) | |
mailinate('Living Social', gmail.inbox.emails(:from => '[email protected]') ) | |
mailinate('AppSumo', gmail.inbox.emails(:from => '[email protected]') ) | |
mailinate('Facebook', gmail.inbox.emails(:from => 'facebook') ) | |
mailinate('Google Calendar Notifications', gmail.inbox.emails(:from => '[email protected]') ) | |
mailinate('New Relic', gmail.inbox.emails(:from => '[email protected]') ) | |
mailinate('Homerun', gmail.inbox.emails(:from => '[email protected]') ) | |
mailinate('Twitter', gmail.inbox.emails(:from => 'twitter') ) | |
# mailinate('', gmail.inbox.emails(:from => '') ) | |
# ... etc ... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment