[ale] Best Way To: email ----> sql Database

Greg Sabino Mullane greg at turnstep.com
Thu Dec 20 13:11:25 EST 2001



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> I wish to..........
> store received emails into a string searchable SQL database
> 1-an email's unedited header, and
> 2-the email's body in another field
[...snippety-do-dah...]

Your question is kind of vague, but I will tell you how I do it. 
I read my mail through a web-based app I wrote that sticks the 
emails into a postgresql database. The program basically does this: 

1. Split the mail into header and body
2. Split the header section into individual headers
3. Parse the headers for important information, which basically 
   means any header that ends up getting used in a query somewhere.
4. Store it all in the database with the xuid as the primary key.

Currently, the table looks like this (simplified):
xuid,
realdate (actual date received)
headerdate (date the sender claimed)
subject
from
to
cc
bcc
status (unread, urgent, replied-to, etc.)
completeheaders
body
size (of the body)

Hope that helps,
Greg Sabino Mullane
greg at turnstep.com
PGP Key: 0x14964AC8 200112201308

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iD8DBQE8IilWvJuQZxSWSsgRAszuAKDQO5YGGfCWSJGgZ9cjTQ7e2wdy4ACghwJk
pVm0X42AasEmQwNeLJwhPME=
=sM4X
-----END PGP SIGNATURE-----



---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list