def where(args = {})
      @message_ids = nil
      @messages = nil

      args.each do |key, value|
        case key.to_sym
        when :body, :subject, :to, :cc, :from
          @query += [key.to_s.upcase, value]
        else
          @query += [key, value]
        end
      end
      self
    end
def where(args = {})
      @message_ids = nil
      @messages = nil

      args.each do |key, value|
        case key.to_sym
        when :body, :subject, :to, :cc, :from
          @query += [key.to_s.upcase, value]
        else
          @query += [key, value]
        end
      end
      self
    end
Builds an Imap search query from the passed `args` hash.  Each key is treated as
 a search key, each value is treated as a search value.  Key/value pairs are appended
 to an array which will be passed to Net::IMAP#search.  For more details on search
 syntax see Ruby std lib docs for Net::IMAP