How can I generate email statistics from mutt header cache?

wnrph

When configured accordingly (set header_cache=) mutt saves the mail headers in a cache file. That could be used to generate mail statistics. Does anybody know something about the file format? Are there any tools available to extract the information contained? (Besides strings, grep, awk and the like)

jmtd

Short answer:

it's entirely possible that the cache will not be comprehensive. If you delete mail and hcache later recomputes the header cache for that mailbox, your stats will not include mail from before the deletion.

If you don't have access to the mail logs for your server, do you have access to a filter mechanism, e.g. procmail? You could use that to generate an alternative log for analysis.

Otherwise, can you poll your mailbox with a program that can generate a log of mail received? Something like an offlineimap filter, or fetchmail/retchmail combined with some hashing and caching.

Longer answer:

The cache file is a DBM-style database. Depending on the exact build options for your mutt, it could be one of QDBM, tokyo cabinet, gdbm or Berkeley DB (BDB); which all implement a variation of BDB's API.

I believe that it is unlikely you can reliably read the DB unless you use the right library implementation. ldd tells me my local mutt uses the tokyo cabinet implementation:

$ ldd /usr/bin/mutt
…
libtokyocabinet.so.8 => /usr/lib/libtokyocabinet.so.8 (0xb74f2000)
…

You would then need to write a program, using that library, to query the BDB stored within the cache file. There are bindings for Perl, Ruby, Lua, Java, and of course C.

It would appear that headers are stored as values in the DB, indexed by a CRC. From what I can tell, the CRC is derived from the path to a mailbox, which implies that the stored headers are the headers for all mail in that mailbox. So your program is essentially going to end up with a buffer containing all headers for all mail in a given mailbox. I don't think it will be much more useful than pulling the headers from all mail currently in your mailbox (and given the "short answer" above, not guaranteed to be more reliable).

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Can I stop mutt from asking for the recipient when pressing m to send a new email?

분류에서Dev

How can I search gpg-encrypted email with notmuch-mutt?

분류에서Dev

How can I return a list of summary statistics?

분류에서Dev

When sending email with Postfix, how can I hide the sender’s IP and username in the Received header?

분류에서Dev

How can i generate pdf using xsl-fo footer and header?

분류에서Dev

How can I generate a HTML with table tags from PDF?

분류에서Dev

How can I show that an email is authentic?

분류에서Dev

How can I disable the prefetch cache?

분류에서Dev

How do you setup mutt for a KolabNow email address?

분류에서Dev

How can I view file header information?

분류에서Dev

Generate Oulook Email From Server

분류에서Dev

How do I create a new folder in Mutt

분류에서Dev

How can I change my email address on launchpad?

분류에서Dev

Swift - How can I add an event listener for cancelling an email dialog?

분류에서Dev

How can I obtain statistics (requests per second, response time) for an app hosted on Cloud Foundry Pivotal?

분류에서Dev

How can I install libpcap header files on Ubuntu 12.04?

분류에서Dev

How can I prepend a header to a file when using cat?

분류에서Dev

How can I add an old email as attachment in replying to a more recent email in Thunderbird?

분류에서Dev

How can I force HyperJaxb to generate toString() method?

분류에서Dev

How can I generate a random number every 24 hours in JavaScript?

분류에서Dev

How can I generate an attribute within Devise registration?

분류에서Dev

How do I remove the cache device from bcache?

분류에서Dev

i have used image as navbar brand in my header but the image comes out of the header how can i solve this in bootstrap?

분류에서Dev

How can I get an array from an If statement?

분류에서Dev

How can I screencast purely from the tty?

분류에서Dev

How can i fetch audios from Soundcloud?

분류에서Dev

How can i take the values from this array

분류에서Dev

How can I stop my email address displaying in the Software Center comments?

분류에서Dev

How can I programatically attach recovery email when creating user's e-mail address

Related 관련 기사

  1. 1

    Can I stop mutt from asking for the recipient when pressing m to send a new email?

  2. 2

    How can I search gpg-encrypted email with notmuch-mutt?

  3. 3

    How can I return a list of summary statistics?

  4. 4

    When sending email with Postfix, how can I hide the sender’s IP and username in the Received header?

  5. 5

    How can i generate pdf using xsl-fo footer and header?

  6. 6

    How can I generate a HTML with table tags from PDF?

  7. 7

    How can I show that an email is authentic?

  8. 8

    How can I disable the prefetch cache?

  9. 9

    How do you setup mutt for a KolabNow email address?

  10. 10

    How can I view file header information?

  11. 11

    Generate Oulook Email From Server

  12. 12

    How do I create a new folder in Mutt

  13. 13

    How can I change my email address on launchpad?

  14. 14

    Swift - How can I add an event listener for cancelling an email dialog?

  15. 15

    How can I obtain statistics (requests per second, response time) for an app hosted on Cloud Foundry Pivotal?

  16. 16

    How can I install libpcap header files on Ubuntu 12.04?

  17. 17

    How can I prepend a header to a file when using cat?

  18. 18

    How can I add an old email as attachment in replying to a more recent email in Thunderbird?

  19. 19

    How can I force HyperJaxb to generate toString() method?

  20. 20

    How can I generate a random number every 24 hours in JavaScript?

  21. 21

    How can I generate an attribute within Devise registration?

  22. 22

    How do I remove the cache device from bcache?

  23. 23

    i have used image as navbar brand in my header but the image comes out of the header how can i solve this in bootstrap?

  24. 24

    How can I get an array from an If statement?

  25. 25

    How can I screencast purely from the tty?

  26. 26

    How can i fetch audios from Soundcloud?

  27. 27

    How can i take the values from this array

  28. 28

    How can I stop my email address displaying in the Software Center comments?

  29. 29

    How can I programatically attach recovery email when creating user's e-mail address

뜨겁다태그

보관