Skip to content

Instantly share code, notes, and snippets.

@vinibaggio
Created June 1, 2011 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinibaggio/1003614 to your computer and use it in GitHub Desktop.
Save vinibaggio/1003614 to your computer and use it in GitHub Desktop.
require 'net/imap'
Net::IMAP.debug = true
imap = Net::IMAP.new('imap.gmail.com', :ssl => true)
imap.login('login', 'senha')
imap.select('INBOX')
loop do
seqno = nil
imap.idle do |response|
if response.kind_of?(Net::IMAP::UntaggedResponse) && response.name == 'EXISTS'
seqno = response.data
imap.idle_done
end
end
imap.store(seqno, "+FLAGS", [:Seen])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment