Email stats at Ma.tt contact form

Curious to know if there is a handy solution for showing cool email stats like Ma.tt’s contact page http://ma.tt/contact/

Inbox: 157. Low priority: 1,461.
Unknown: 155. I’ve sent out 920 emails
to 357 people in the past month.

Related posts

Leave a Reply

2 comments

  1. This is actually not all that hard to do using the imap functions in PHP: http://php.net/manual/en/book.imap.php

    Basically, he has some script somewhere which runs every hour or so. I have not seen this script, but I can venture a good guess about how it works.

    First, it connects to his email system, probably using imap.

    Second, it performs some set of custom rules to divide new emails into high and low priorities in some manner. This much is obvious from the contact page.

    Third, it gets the counts and stores them in a database table custom made for storing this count.

    To display the graphs, I wrote some queries in a Page Template that connects to that custom table, gets the counts for the last month, does a bunch of math and reformatting of the numbers, and finally produces a URL to the Google Chart API with the numbers to display the graph.

    A very minimal knowledge of PHP and a server with the php_imap extension is all that’s really required to script your own email. This is a highly instructive read if you’ve never taken a look at it before:

    http://php.net/manual/en/book.imap.php

  2. As far as I know stats are not really inherent feature of email. In comments under Email Graphs post about this feature Otto says that stats are pulled out of database.

    So they are somehow tracked in first place, which has little to do with WordPress. It depends on what you use for your email account and server (if not from some free service).