This is a Spotlight plugin for the mail folder of MH or Gnus nnml backend. It extracts metadata from numbered files under Mail directory, and imports the metadata into Spotlight database.
It uses Ruby interpreter to extract metadata. So you can easily customize the extraction to edit GetMetadataForFile.rb file. But processing is slightly heavy because of Ruby.
To parse mails, it includes TMail library. To parse HTML mails, it includes ymHTML library.
Version 0.1.4u supports Universal Binary. It will work on Intel Mac (2008-01-06).
Copy MailSpool.mdimporter to ~/Library/Spotlight/.
## list plugins $ mdimport -L ## test extraction $ mdimport -d2 -n ~/Mail/test/ ## import $ mdimport ~/Mail/test/ ## list metadata $ mdls ~/Mail/test/1 ## test to search $ mdfind -onlyin ~/Mail/ 'kMDItemTitle == "Test*"'
(require 'gnus-spotlight) (gnus-spotlight-insinuate)
gnus-group-mode: \C-c\C-n gnus-spotlight-search gnus-summary-mode: \C-c\C-n gnus-spotlight-search
Search words can be completed by <TAB> key.
kMDItemTitle=="Subject"kMDItemAuthors=="From Name"kMDItemAuthorEmailAddresses=="From Address"kMDItemRecipients=="To Name"kMDItemRecipientEmailAddresses=="To Address"kMDItemContentCreationDatekMDItemTextContentTMail is under LGPL,and the other parts of plugin are under Ruby license.
gnus-spotlight.el is under GPL.