libraries for handling mail files

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
brucelina
Forum Newbie
Posts: 2
Joined: Wed Jul 20, 2005 5:52 am
Location: Pune, India

libraries for handling mail files

Post by brucelina »

Hi,

I need some help in file indexing and parsing.

I need to store messages (to and from ) in mail file format and parse them to show up. [I would not be sending actual mails)

Directory structure would be like userid/inbox , userid/sent etc .. ( 1 file per users per folder)

Is there any library which convertis message in mail like format and parse it for reading.

what about indexing this file? how to do indexing of a file ( mail file or text file in any format) so that it would give good performance (while adding, searching), considering the file may have 1000 msgs or so ..

Please let me know if you have any ideas on how to do this, or where i can find out more.

Thank you!
Brucelina
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

imho the best way to do searching/indexing/parsing is by storing the data in a dbms...

what do you mean with mail format? mbox or Maildir?
brucelina
Forum Newbie
Posts: 2
Joined: Wed Jul 20, 2005 5:52 am
Location: Pune, India

more details about my reuirement

Post by brucelina »

Thanks for the reply.

Let me tell you the reqirement here. I am curretly storing the messages from and to users in database, it is affecting a performance of a page (bcoz of database calls). In future, number of records will increase in number so i am thinking of shifting to flat file database..(currently using MySql)

for that -

1. I will be storing the message in text file in

mail like format -
To: ---[email address]
From: ---
message: ----

just like unix stores mails. (Say mbox)

I guess that is simple and most used format + I can get libraries to parse these file easily... I am worried about indexing.. IF these files are
not indexed, adding or searchign message can be a performance issue again..

so need help in that regards.

how to do indexing on flat files? how to update index etc.. what will happen after deleting record , For each insert n deletion, i will need to
update index .. how feasible that it etc..

Hope that gives you idea. Let me knwo if u have any query regarding that.

Thanks,
Brucelina
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You can't do indexing on flat files. There's just plain text files.

mbox is known to be slow and messy and that's why Maildir was brought in.

That said... parsing mbox files should be relatively easy... ;)
Post Reply