Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > net/imapライブラリ > Net::IMAPクラス > search

instance method Net::IMAP#search

search(keys, charset = nil)
uid_search(keys, charset = nil)

Sends a SEARCH command to search the mailbox for messages that match the given searching criteria, and returns message sequence numbers (search) or unique identifiers (uid_search).

ex).

p imap.search(["SUBJECT", "hello"])
#=> [1, 6, 7, 8]
p imap.search('SUBJECT "hello"')
#=> [1, 6, 7, 8]