idle(timeout = nil, &response_handler) public

Sends an IDLE command that waits for notifications of new or expunged messages. Yields responses from the server during the IDLE.

Use #idle_done() to leave IDLE.

If timeout is given, this method returns after timeout seconds passed. timeout can be used for keep-alive. For example, the following code checks the connection for each 60 seconds.

loop do
  imap.idle(60) do |res|
Show source
Register or log in to add new notes.