Penang
Penang

Reputation: 1305

Imap folder only returning a subset of emails with it

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}'"

Upvotes: 2

Views: 463

Answers (2)

Penang
Penang

Reputation: 1305

There is a solution

Go to Settings > Labs within Gmail and Enable Advanced IMAP Controls enter image description here

You should now be able to change the folder size limits in Settings > Forwarding and POP/IMAP

Advanced IMAP Controls Enabled: Enabled

Advanced IMAP Controls Disabled (default): Disabled

Upvotes: 5

Michael Papile
Michael Papile

Reputation: 6856

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)

Upvotes: 3

Related Questions