On 9.4.2012, at 22.39, Alexander Chekalin wrote:
Hello, Timo,
I feel a bit unsure about "which 'date' I mean", since I always consider the only date from Date: header. But which value is used as INTERNALDATE then? As soon as I use (for now) maildir storage type, all the metadata are stored in messages. So I expect Dovecot somehow parse and use Date: field itself, or I'm wrong with it?
The INTERNALDATE means the same as "received date", while the Date: header is the "sent date". With mbox format the received date is stored in the separating From-lines. IMAP supports searching and sorting messages by either INTERNALDATE or Date: header
And also what's about messages without Date header at all?
The searching just doesn't match those messages then. Sorting falls back to using received date.
But the Date isn't the worst thing. Look, to have my archive work I setup server-side filter which redirect all messages it processed also to my archive mailbox. This way, each message (after such a redirect) targeted to 'archive@mydomain', instead of its original destination email. The only place I can find out the original recipient is to parse 'Recieved' field(-s).
As I think I understand that none of these headers (Date or Received) are to be used for SEARCH anyway, and this was the idea behind creating my own index. But wait, is there any way I can make Dovecot also index additional fields (yes, I talk about 'Received') - then it'll be the best solution!
If you do a SEARCH HEADER Received, then Dovecot adds the Received headers to dovecot.index.cache file and the subsequent searches should be quite fast, although the Received headers increase the cache file's size quite a lot. Also alternatively you can enable full text search indexes (Lucene or Solr) and the search is then done from them.