Skip to content

Instantly share code, notes, and snippets.

@tpitale
Created November 28, 2012 19:35
Show Gist options
  • Select an option

  • Save tpitale/4163527 to your computer and use it in GitHub Desktop.

Select an option

Save tpitale/4163527 to your computer and use it in GitHub Desktop.
IMAP fail example snippet
require 'net/imap'
# snippet
@imap = Net::IMAP.new('imap.gmail.com', :port => 993, :ssl => true)
@imap.login('username@gmail.com', 'password')
@imap.select('INBOX')
idler = Thread.start {
@imap.idle {|response| puts response}
}
sleep 10
puts "Triggering idle_done"
@imap.idle_done
puts "Done idling" # never gets here
require 'net/imap'
# snippet
@imap = Net::IMAP.new('imap.gmail.com', :port => 993, :ssl => true)
@imap.login('username@gmail.com', 'password')
@imap.select('INBOX')
idler = Thread.start {
@imap.idle {|response| puts response; idle_done}
}
sleep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment