Solved

Delphi: What is a simple DB to use for an email program?

Posted on 2004-09-25
10
198 Views
Last Modified: 2010-04-05
I have decided to write myself a simple POP3 Email Client based on some freeware components I found. There are a few simple features I would like that MS Outlook doesnt have, and I have decided the best way to get them is to write them myself. I'm not trying to take on Microsoft or change the world, I just have a few simple, specific needs that I know I'm capable of writing.

I'm not sure what is the best way to store the messages once they are downloaded, and this is my question.

I could store them in folders as .eml files. this approach would be simple, but I can see big speed problems when populating the inbox - ie having to open hundreds of files to get the info.

I use a MySQL database for everything else I do, but this needs to be installed, and the tables would need to be loaded via an SQL file. I was hoping to use a DB that can install itself easily via my app so I can share my program with friends.

The DB needs only be single user, needs to be installable via the app, and it would be preferable if it takes SQL commands as I am familiar with these. I also want to avoid the Borland Database Engine if possible, I have had grief with this in the past.

Is using MS Access via the Access Runtimes a viable option? I understand these are a free component that allows your app to use a .mdb file but the user doesn't need MS Access installed on their machine. If this is a good option, how would I go about connecting to an Access database via Delphi (pref without BDE). Thanks in advance.
0
Comment
Question by:harveykane
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 12

Expert Comment

by:esoftbg
ID: 12152174
You may use firebird avoiding BDE via Interbase components (Delphi VCL). But firebird must to be installed before using it ....
Firebird-1.5.0.4306-Win32.exe that I have is 3.76 MB
http://prdownloads.sourceforge.net/firebird/Firebird-1.5.0.4306-Win32.exe?download
or
http://sourceforge.net/projects/firebird/

//........

You may use MS Access database avoiding BDE via ADO. But it must to be installed MS Data Access Components (MSDAC). It is provided as MDAC_TYP.EXE (version 2.8 that I have is 5.3 MB)
http://msdn.microsoft.com/isapi/gomscom.asp?target=/downloads/details.aspx?FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c&DisplayLang=en
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12152631
Using MS Access through the ADO components would be a good solution. But I have done something similar too and just stored the emails in an XML file. But if you receive lots of emails, your database will become huge.
In the end, I just decided to store each email as a separate *.eml file and used an XML file as index for all emails. But I also filter the emails and divide them over multiple folders. The XML file would just contain a summary of the email contents. (Sender, subject, etc.)

But Access requires the user to have ADO (not specifically Access) to be installed on their system. Especially on W2K and before, ADO would require a separate installation. (But is free.)
InterBase is an option too but it's a bit troublesome to install and maintain InterBase for the generic user. Most developers can handle it but most users don't.
FlashFiler is an interesting Client/Server database and can be found at http://sourceforge.net/projects/tpflashfiler/ FlashFiler is especially useful if you want multiple users to connect to a centralized mailbox. ;-) FlashFiler doesn't require any additional files either. You could have everything within a single executable.
But I mentioned XML, didn't I? If you want to keep it real simple, use just an XML file. It's main advantage is that combined with an XSLT stylesheet you could easily display the XML file in a webbrowser as HTML. And within Delphi an XML file is just an array of array within arrays...
0
 
LVL 4

Accepted Solution

by:
Delphian earned 75 total points
ID: 12153747
If wanna get on a relational DB, Firebird offer the
possibility of using a embedded server.
A embedded server is just a FB server encapsulated
on a single DLL you could run from your program.
Just local access, no network issues and you could
use the dll also as client for a remote server.
See www.firebirdsql.org or www.ibphoenix.com for
articles and/or details about this.

[]s Delphian
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 12158478
definitely FireBird Embeded .. no instalation required, small footprint, powerful RDBMS
0
 
LVL 2

Author Comment

by:harveykane
ID: 12163949
OK, Thanks for the comments so far, I will look into all options and post points accordingly :)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 30

Expert Comment

by:Wayne Barron
ID: 12256439
If you decided to go with the Access Database.
It will get HUGE, but Access Database's are designed to grow to
Around 2 - 3 Gigs in Size. I cannot remember the exact number.
As I had ask the question in a Microsoft Access Newsgroup once before.

So as long as you are not plaining on keeping the messages forever.
Then Access could be a good Fast way of going about you e-mail project.

( As I doubt that you would allow your Inbox or Extra Folder to grow that huge anyway :-) ) But if you are plaining on using Access.
Then I would also do a Backup on it as well. This just in case of Corruption of the Database. Maybe set it to do the Backup on "Every Close of the Program" this will save you a lot of troublesome times...
Believe me, I lost my Outlook InBox DB. and it was not pretty.
Business e-mails and everything down the drain.

Create a good program, Make it do "OnClose - DB Saves"

Take Care HTH

Carrzkiss
0
 
LVL 17

Assisted Solution

by:Wim ten Brink
Wim ten Brink earned 50 total points
ID: 12261985
I did create my own POP3 mailreader once and to keep the database fast, I didn't store the emails in the database, because I receive about 100+ emails every day with sizes varying from a few KB to several MB's. What I did was simple. I created a folder where the emails would be stored. But because this too would become quite large, I would create a subfolder every day, with the date (YYYY-MM-DD) as folder name. In these folders I stored the raw emails and all I stored in the database was the header information for every email. Sender, recipients, subject, date etc. are stored in in an SQL Server database with the filename of the raw email allowing me to do some quick searches for specific mails and also allows me to define special mail folders. I wouldn't move them physically in my folders.
0
 
LVL 4

Expert Comment

by:Delphian
ID: 12277094
This is the approach of PMMail also, but they allow search and
filters based on message text.
There is not a central DB but some texts file with the headers.
But the app slow down with many messages in the same folder
(which occur with my mail lists).
But... SQL Server? There is nothing more expensive ? ;-))))))
(just a kidding...)
0
 
LVL 4

Expert Comment

by:Delphian
ID: 12299322
Workshop_Alex:
You could store the msg within a blob (in the case, a image field)
and allow text search in the blob, without the mess with transliteration
and charsets.
The file will grow, but is better (and faster) than seaching files - which
tends to slow

harveykane:
I'd go for Firebird embedded.
0
 
LVL 2

Author Comment

by:harveykane
ID: 12301599
Thanks for the comments everyone.

I ended up using Firebird Embedded as per Delphian's suggestion - OMFG what a great solution. Full functionality contained within a single DLL, and if I wanted to go for multi-user later on, just install the Firebird server and change a couple of lines of code.

I'm not sure if I will store message itself in the DB, or in the eml file yet. I will probably store the message body text in the DB so it's searchable, and the rest of the message including source and attachments in dated folders as per workshop_alex's suggestion.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now