I am using Net::IMAP::Client to clean up my mail folders on my providers host.
At first I search the messages matching some criteria:
The doc says:
search($criteria, $sort, $charset)
Executes the "SEARCH" or "SORT" IMAP commands (depending on wether $sort is undef) and returns the results as an array reference containing message ID-s.
Note that if you use
$sortand the IMAP server doesn't have this capability, this method will fail. Use "capability" to investigate.
$criteria
Can be a string, in which case it is passed literally to the IMAP command (which can be "SEARCH" or "SORT").
It can also be an hash reference, in which case keys => values are collected into a > string and values are properly quoted, i.e.:
{ subject => 'foo', from => 'bar' }will translate to:
'SUBJECT "foo" FROM "bar"'which is a valid IMAP SEARCH query.
If you want to retrieve all messages (no search criteria) then pass 'ALL' here.
I need to search for all mails where subject matches 'this' or 'that'.
This is what I tried:
{ subject => 'this', subject => 'that' }
But it correctly returns only mails with 'that' in subject line.
Any suggestions ?