<<< Date Index >>>     <<< Thread Index >>>

Re: Reading mail stored in a DB



On Tue, Dec 27, 2005 at 10:05:28PM +0100, Travis Spencer wrote:
> On 12/27/05, Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx> wrote:
> 
> > On Tuesday, December 27 at 12:01 PM, quoth Travis Spencer:
> > > Does mutt currently have support for reading mail stored in a
> > > database server
> ...
> > No, it doesn't. There is no standard for how to store mail in
> > relational databases (every mail-in-a-database system is different),
> > so such "support" would be rather silly.
> 
> I'm not sure if I was clear, but the details of the database schema or
> message insertion/retrieval is not what I meant by support.  

> I was wondering if mutt provides a mechanism analogous to
> query_command's usage in managing/viewing addresses that I could use
> to manage and view messages stored in a database.  

Mutt query mechanism doesn't allow you "to manage and view."  It's a
one-way street.  You can view, but not manage.  

Well, you can, but your database, instead of being relational, would
have to take the form of an mbox (or be exported into that form), and
instead of writing querries, you'd have to rely on mutt's filtering to
view the data.  While that sounds bizarre, it works quite well and is
exactly how I maintain my personal address book.  My own query is
actually a Perl script that parses an existing mbox that contains
name/address/etc fields in place of email headers, and free-form text in
the "body" of each entry, or message.  New entries are added by
"appending" a blank message to the mbox (using a simple script), and
entries are modified or deleted within mutt (well, mutt + vim).

While you're laughing, I'll also point out that I regularly dump data
from databases, from the file system and elsewhere into mbox format that
I read/search/filter/etc. at leisure with mutt.  Why?  It's easier.
Mutt's limit command, for example, is far more useful and friendly than
repeatedly grepping files, running output through a pager and so on, and
definitely more convenient than writing SQL and reading its output in a
terminal window or worse, opening a browser window to read formatted
output generated with PHP.  And given that mutt can read in an mbox with
a few hundred thousand entries without breaking a sweat, finding
something becomes both easy and brainless.

I also have a formatted version of the Mutt Manual dumped into an mbox
(each "entry" being a subsection).  Once the index view is customised,
you can't distinguish the fact that you're using an email client and not
some ncurses-based documentation viewer with super-keen regexp support.

So, to sum up, mutt can read messages in a database, but only if you
remove them from the database.  I doubt that's what you're looking for
or wanted to hear, but unless your needs or preferences are unique like
my own, you're heading down a dead-end street.  Or to use Kyle's words,
it's a silly idea.

-- 
George