[FRPythoneers] ANNOUNCE: Mail2DB -- Insert incoming mail into a SQL database.
jafo at tummy.com
Sun Jan 7 01:17:25 MST 2001
I've just released a program which Evelyn and I wrote over dinner. It
reads e-mail from stdin and inserts it into a PostgreSQL database.
You can find it at ftp://ftp.tummy.com/pub/tummy/Mail2DB/
Evelyn Mitchell, efm-mail2db at tummy.com
Sean Reifschneider, jafo-mail2db at tummy.com
Copyright (c) 2001, Sean Reifschneider and Evelyn Mitchell, tummy.com, ltd.
All Rights Reserved
WHAT IS IT
Mail2DB is a program which can be used in a .qmail/.forward file to
store incoming e-mail in a database. This is not (currently) meant for
directly reading of mail, it's more meant as an archive. The message
data is stored in a file in the file-system, and certain header data is
stored in the database.
Added the outstanding fields, reduced the set of "quoted" characters.
The database should now be fully populated. This should be fully usable.
Evelyn and I implemented it over dinner tonight. This is the first
release. It will insert most fields into the database, but there are
some lacking (basicly all the optional ones). See "TODO" for more
information on currently-outstanding tasks.
This requires Python, Postgres and the Postgres Python modules. If you
get the RPMs from postgresql.org, you need to install the postgresql-python
RPM and you should be fine. If called from a QMail .qmail file, the
envelope sender and recipient will also be stored.
All fields stored in the database are "URL quoted" (efm-mail2db%40tummy.com).
You'll need to decode these fields upon retrieval.
It makes a default connection to the database. This means that it connects
to the database named after your user-id.
Modify the "reposDir" line in the "mail2db" file to point to the directory
you want the mail data archive to be stored in. Note that if the reposDir
directory doesn't exist, it will be created.
Put "mail2db" somewhere and do a "chmod 755" on it.
Directly inject a message. For example, save a mail message as /tmp/msg,
then do "./mail2db </tmp/msg". Check the database and the repository.
It should be in both places -- if not there is a problem with your setup.
Put "|/path/to/mail2db" in your .qmail file(s).
Send yourself a test message and check the database.
Just because something doesn't do what you planned it to do doesn't mean
it's useless. -- T. Edison
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python
More information about the FRPythoneers