add_response_handler

add_response_handler(handler = Proc.new)
Instance Public methods

Adds a response handler. For example, to detect when the server sends us a new EXISTS response (which normally indicates new messages being added to the mail box), you could add the following handler after selecting the mailbox.

imap.add_response_handler { |resp|
  if resp.kind_of?(Net::IMAP::UntaggedResponse) and resp.name == "EXISTS"
    puts "Mailbox now has #{resp.data} messages"
  end
}
doc_ruby_on_rails
2015-04-22 00:15:11
Comments
Leave a Comment

Please login to continue.