class Net::IMAP

def add_response_handler(handler = nil, &block)

Related: #remove_response_handler, #response_handlers

}
end
puts "Mailbox now has #{resp.data} messages"
if resp.kind_of?(Net::IMAP::UntaggedResponse) and resp.name == "EXISTS"
imap.add_response_handler { |resp|

mailbox:
add the following handler after selecting the
indicates new messages being added to the mailbox),
the server sends a new EXISTS response (which normally
Adds a response handler. For example, to detect when
def add_response_handler(handler = nil, &block)
  raise ArgumentError, "two Procs are passed" if handler && block
  synchronize do
    @response_handlers.push(block || handler)
  end
end