Created
February 5, 2013 23:29
-
-
Save saramic/4718702 to your computer and use it in GitHub Desktop.
from the command line get the lastest 10 emails from GMail and print the from email address. assumes ruby and rubygems are installed.
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
# based on http://dcparker.github.com/ruby-gmail/ | |
# get latest 10 email addresses from GMail inbox emails | |
gem install gmail | |
export USRENAME=my_name PASSWORD=my_password | |
ruby -e 'require "rubygems"; require "gmail"; \ | |
Gmail.new(ENV["USERNAME"], ENV["PASSWORD"]){|gmail| \ | |
gmail.inbox.emails.each_with_index{|email, index| \ | |
puts email.from.collect{|address| \ | |
"#{address.mailbox}@#{address.host}"}; break if index > 9 } }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment