ABOUT
This Ruby gem wraps around Net::IMAP and TMail to provide GMail functionality.
AUTHOR
Animoto.com
INSTALL
This gem is hosted on gemcutter.org. You must install the gemcutter gem and add it as a repository. sudo gem install gemcutter gem tumble
USAGE
gem ‘animoto_gmail’, :lib => “gmail” require ‘gmail’
Animoto::GMail.logger = Logger.new(STDOUT) gmail = Animoto::GMail.new(EMAIL, PASSWORD) conditions = => SUBJECT, :since => “1-Dec-2009”, :before => “2-Dec-2009” messages = gmail.search(:conditions => conditions, :full_message => true, :limit => 10) puts “MESSAGE COUNT #messagesmessages.size” messages.each { |m|
# DO WHAT YOU GOTTA DO
}
Please review IMAP RFC for parameters for searching. ruby-doc.org/stdlib/libdoc/net/imap/rdoc/classes/Net/IMAP.html#M000738
:limit is an optional argument to limit the number of fetches done on subsequent calls to retrieve the email body. Without this argument, every message from the search will be fetched.
TESTING
Tests can be executed via:
rake test
There is a simple test. To test yourself, please enable INTEGRATION and add your gmail email and password to the test file.
VERSION HISTORY
.0.0.2 - Clean up activesupport use since it is deprecated. .0.0.1 - Initial gem-ification process of original code.
TO DO