On 19.8.2012, at 9.47, Sean Kamath wrote:
I'm thinking about adding at least one new SEARCH command extension to Dovecot: ability to search from any headers in the mail, including MIME headers in the body. So the idea is that you could somewhat quickly ask e.g. "show me all mails with pdf attachments":
a search or x-anyheader application/pdf x-anyheader .pdf b fetch $ bodystructure
The client can verify the results with the fetch.
Once feature of their search capability that sometimes is nice is the ability to not only see if it has an attachment (has:attachment) but the ability to search for the attachments by a specific name (filename:<text>). That can be, and has proven, useful. I suspect this could turn into a nightmare, however. Ditto something like "has N attachments" (sometime I dearly wish I had at times -- I want to find that damn message with like 10 attachments). Or math around number of attachments.
Actually searching by attachment filename was also in my requirements list, but I forgot to mention it. It can anyway be done the same way as the pdf example above. The bodystructure reply includes attachment filenames. Of course you'll still need a client that can give a nice UI for those..