Ruby gem for Gmail's API
Add the gem to your Rails app's Gemfile
gem "gmail", git: "https://github.com/nisanthchunduru/gmail-ruby", branch: "main"and bundle install
bundle installgmail = Gmail.new(google_oauth_access_token)
# Fetch the 100 most recent messages and print a snippet of the each message
messages = gmail.messages
messages.each { |message| puts message.snippet }
# Fetch the next 100 most recent messages and print a snippet of each message
messages = messages.next_page
messages.each { |message| puts message.snippet }
# Find a message by its RFC 2822 Message-ID
message_id = "[email protected]"
message = gmail.find_message_by_message_id(message_id)
# Fetch a message's raw and print it
puts message.retrieve("format" => "raw").raw- Port tests from the app
- Modify the
Gmail::Message.rawmethod to fetch the message in therawformat so gem users don't have to do it themselves - Add a license
- Publish to rubygems.org