https://github.com/mikel/mail
Ruby
A Really Ruby Mail Library
Mail::IMAP#find
Find emails in a IMAP mailbox. Without any options, the 10 last received emails are returned.
Possible options:
mailbox: mailbox to search the email(s) in. The default is 'INBOX'.
what: last or first emails. The default is :first.
order: order of emails returned. Possible values are :asc or :desc. Default value is :asc.
count: number of emails to retrieve. The default value is 10. A value of 1 returns an
instance of Message, not an array of Message instances.
read_only: will ensure that no writes are made to the inbox during the session. Specifically, if this is
set to true, the code will use the EXAMINE command to retrieve the mail. If set to false, which
is the default, a SELECT command will be used to retrieve the mail
This is helpful when you don't want your messages to be set to read automatically. Default is false.
delete_after_find: flag for whether to delete each retreived email after find. Default
is false. Use #find_and_delete if you would like this to default to true.
keys: are passed as criteria to the SEARCH command. They can either be a string holding the entire search string,
or a single-dimension array of search keywords and arguments. Refer to [IMAP] section 6.4.4 for a full list
The default is 'ALL'Edit
git clone [email protected]:mikel/mail.git
cd mail
open lib/mail/network/retriever_methods/imap.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Mail--IMAP-find-for-pr
# Commit to gitgit add lib/mail/network/retriever_methods/imap.rbgit commit -m "better docs for Mail::IMAP#find"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Mail--IMAP-find-for-pr
hub pull-request
# Celebrate!