Skip to content

Instantly share code, notes, and snippets.

@gouf
Created January 9, 2013 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gouf/4496823 to your computer and use it in GitHub Desktop.
Save gouf/4496823 to your computer and use it in GitHub Desktop.
require 'gmail'
APPLICATION = '/Applications/Google\ Chrome.app'
ACCOUNT = 'your_gmail_account@gmail.com'
PASSWORD = 'password'
MAIL_FROM = 'your_mobile_phone@exmple.com'
gmail = Gmail.connect ACCOUNT, PASSWORD
gmail.inbox.emails(:unread, from: MAIL_FROM).map do |mail|
text = mail.body
uri = /http:\/\/t\.co\/\w+/.match text.to_s
mail.delete! if system "open -a #{APPLICATION} #{uri}"
sleep 5
end
gmail.logout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment