 <p>I have not used it, but Apache James looks like it will support a SQL Backend: <a href="http://james.apache.org/server/3/feature-persistence.html" rel="nofollow">http://james.apache.org/server/3/feature-persistence.html</a> (Make sure you use version 3).</p> <p>Amother option might be to use Apache James Mailets (These are like Servlets for mail) and have them write the statistics to a database when an action takes place on the mail server.</p>