Author |
|
Itzik Guest Group
Joined: 10 November 2003
Online Status: Online Posts: 262
|
Posted: 16 June 2005 at 6:32pm | IP Logged
|
|
|
Hi Alex,
what is the best way to insert mail into database?
To insert it as one mail?
or to insert it divided (to,cc,subject,bodytext..)?
What is the code to insert it? I didnt find it in the documents.
Thank you,
Itzik
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 16 June 2005 at 6:50pm | IP Logged
|
|
|
As they say, it depends...
For example, our WebMail Pro application stores message headers and body in the databse while attachments are saved as files.
But it's possible to save entire messages into database.
Or, you can save message headers and general information like message size into database and also save entire message as files.
The decision is up to you. If you're MSSQL server user, you can store everything in database (for example, one table contains message headers, second - message bodies, third - attachment bodies). MS Access is not strong enough to maintain gigabyte databases so it would be better to have only message headers + body text in database and save attachments into files. In database, you can have table which links messages and attachments.
If you choose files-oriented approach (when messages are stored as .EML files), you can save/load messages to/from disk using ImportFromFile/SaveMessage methods. You can still have message headers duplicated in the database - this would allow you to efficiently display message lists, etc.
You can also save message body (in addition to message headers and general message information like message size, attachment file names and sizes, etc) in the database - this will also add full-text search capabilities to your mail engine. Still, when the message is accessed, you display it from .EML file.
I would prefer this approach if there are no other considerations.
Of course, you're free to implement your own techiques, for example, you can never store raw body (neither in .eml files nor in database) and store individual message parts only.
Regards,
Alex
|
Back to Top |
|
|