Without getting into objects, the easiest way to handle mail message
storage is using the University of Washington C-Client library, which is
used in pine and loads of other mail readers and servers. That gets you a
common interface to just about every mailbox format since the dawn of
time, including simple access to IMAP.
With IMAP, you can use really cool mail stores like CMU's cyrus imapd,
which keeps databases of headers allowing really fast access to even the
biggest mailboxes. Using c-client to build a server module, and using
cyrus as the mail store should let you leverage things really fast.
(see http://andrew2.andrew.cmu.edu/cyrus/cyrus.html for details both
cyrus and most everything else mailish)
(defun modexpt (x y n) "computes (x^y) mod n"
(cond ((= y 0) 1) ((= y 1) (mod x n))
((evenp y) (mod (expt (modexpt x (/ y 2) n) 2) n))
(t (mod (* x (modexpt x (1- y) n)) n))))