scottayy wrote:Hmm, this could get interesting.
Surely you're not storing attachments in the database? I think I would write those to files and have some database flag to indicate if there is an attachment and then the location of the attachment.
Uuuuuh well for now I am storing them in the database

sorry about that - although I can still rewire my code to write the contents to raw files though. I just thought it seemed pretty cool to have your file contents included in the same place as your file info..
The way how its set up is that I have one table which contains teh information of teh email such as subject date attachment flag, message id, headers, message parts all serialized of course and a table for files which contain all files - sorry and one relationship table that links the two based upon message id, file id and attachment part.
scottayy wrote:
I think this type of handling would be much better as a daemon that you could easily stop/start/restart.
Well the thing is that this going to be a multi user application - so we would have different users having different email accounts and each user would require downloading from their own email account. I do think that keeping the process of downloading from the imap server away from the actual client code is a good idea as the whole point is that the users would use the webmail client as though it is accessing the emails from an imap server when infact its really accessing from a database which is periodically updated with new emails.
The question is how do I implement this downloading new emails part considering that it is not for just one email but a set of emails. And likewise how do I work out the logic so that:
In case connection is lost - you don't end up with messy data
You don't duplicate entries - I've read that the UIDs are not static so they cant function well as a unique ID - although Ive read about the message ID generated for each email - or there is the option of deleting each email once downloaded so this issue is pretty much resolved.
Once more point is that - well I'm not aware of using cron or windows scheduled tasks - how would we set up such a scheduled task to run such that - lets say we set it up to run every 2 minutes - lets say our script at one point takes over 2 minutes to run - how do we set it up so it doesn't interfere with the script whilst it is being processed
