[FIX] mail: when checking for possible messages to fetch, perform
a search_count on mail_message when the actual number of messages or their
ids is not necessary, to speedup the computation.
[FIX] [IMP] mail: mail_message: when checking that access rights are not
violated in _search, do it in SQL to speedup the query. Indeed doing it via search and
browsing the results to validate the various rules is quite costly.