Skip to content

Instantly share code, notes, and snippets.

@codesnik
Created September 2, 2013 13:01
Show Gist options
  • Save codesnik/6412609 to your computer and use it in GitHub Desktop.
Save codesnik/6412609 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'bundler'
Bundler.setup
require 'gmail'
Gmail.connect!('[email protected]', '...') do |gmail|
emails_count = gmail.inbox.emails.count
gmail.inbox.emails.each_with_index do |email|
puts "#{email.uid} / #{emails_count}"
File.open("mailbox/#{email.uid}", 'wb') do |f|
f << email.raw_message.raw_source
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment