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

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.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You may use firebird avoiding BDE via Interbase components (Delphi VCL). But firebird must to be installed before using it ....
Firebird- that I have is 3.76 MB


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)
Wim ten BrinkSelf-employed developerCommented:
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 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...
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 or for
articles and/or details about this.

[]s Delphian

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

definitely FireBird Embeded .. no instalation required, small footprint, powerful RDBMS
harveykaneAuthor Commented:
OK, Thanks for the comments so far, I will look into all options and post points accordingly :)
Wayne BarronAuthor, Web DeveloperCommented:
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

Wim ten BrinkSelf-employed developerCommented:
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.
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...)
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

I'd go for Firebird embedded.
harveykaneAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.