imap: use Gmail's X-GM-RAW to do a sample search

Only one search result seems to be returned, for some reason.
imap: introduce a listMessages() helper