The following script only return 1000 messages within from the sent folder when the actual number of sent messages is in the 3000+
How can I get the rest of the messages?
username = ask("Enter your username: ") { |q| q.echo = true }
password = ask("Enter your password: ") { |q| q.echo = "*" }
look_in_folder = "[Gmail]/Sent Mail"
save_to_folder = "/Users/penang/Desktop"
puts 'Starting...'
imap = Net::IMAP.new('imap.gmail.com', '993',开发者_如何学运维 true)
puts "Logging in as #{username} ..."
imap.login(username, password)
imap.examine(look_in_folder)
mails = imap.uid_search(["FROM", "me"])
puts "Found #{mails.count} mail(s) in folder '#{look_in_folder}'"
There is a solution
Go to Settings > Labs within Gmail and Enable Advanced IMAP Controls
You should now be able to change the folder size limits in Settings > Forwarding and POP/IMAP
Advanced IMAP Controls Enabled:
Advanced IMAP Controls Disabled (default):
The answer is that there is not anything you can do, it has nothing to do with your script or Net::IMAP. Google is not giving you more than 1000 mails for any folder via IMAP, and there are numerous complaints about this online (IE http://www.google.com/support/forum/p/gmail/thread?tid=2636f734144eeb28&hl=en)
精彩评论