Home   Buy Now   Products   Downloads   Support   Resellers   Contact   Site Map  
Home   Buy Now   Download   Support  
Email Component, SMTP Component, POP3 Component, IMAP Component, bulk mail

Home
Purchase
Upgrade
 
Products
Downloads
 
Support
 Samples
 KB
 Forum
 
Newsletter
 
Customers
 Current List
 Comments
 
Resellers
Jobs
Contact Us
 March 19, 2003  

Volume 1, Issue 3 

Page Navigator: << Back, 1, 2, 3, 4, 5

Bonus:  Storing and Managing Messages Locally

Since POP3 does not provide a way to organize and manage messages on the server, many POP3 applications, such as Outlook Express, download the messages from the server and store them on the local hard drive.  It is typical for these applications to provide an easy to use interface that allows users to organize messages in folders.

If you would like to add this type of functionality to your application, we have a solution that was designed just for the purpose.  The EasyMail MailStore object enables your application to easily store, organize and retrieve messages in a specialized, lightweight database system on the local hard drive.

Creating the store

Set objMailStore = CreateObject("EasyMail.MailStore")
objMailStore.CreateStore "c:\", 0
objMailStore.OpenStore "c:\", 0
objMailStore.CreateFolder "Inbox", 0
objMailStore.CloseStore

A store can be created in any directory.  Here we create the store in the root directory and create a folder called "Inbox".  We can create a virtually unlimited number of folders, and nest them too.  i.e. Inbox\Save.

Downloading a message and adding it to the store

set objPOP3 = CreateObject("EasyMail.POP3")
objPOP3.MailServer="mail.domain.com"
objPOP3.Account="account"
objPOP3.Password="password"
objPOP3.Connect
ret = objPOP3.DownloadSingleMessage(1)
if ret>=0 then
   set Message = objPOP3.Messages(1)
   Set objMailStore = CreateObject("EasyMail.MailStore")
   objMailStore.OpenStore "c:\", 0
   objMailStore.SelectFolder "Inbox", 0, 0 
   strFile=objPOP3.Messages(1).TempMsgSourceFile
   objMailStore.AddMessageFile strFile, "", 0 
   objMailStore.CloseStore
end if
objPOP3.Disconnect

We begin by using the EasyMail POP3 object to download a message.  In this case, to keep things simple, we simply download the first message in the mailbox.  To add the downloaded message to the store we pass in the raw unparsed RFC-822 message file.  This is available from the TempMsgSourceFile property of the EasyMail Message object.  We add the message to the "Inbox" folder in our store.  When a message is added to the store, its header is parsed and a copy of the header data is stored is a special database format that will enable our application to retrieve it in the future very quickly without reparsing. 

Retrieving a message from the store

Set objMailStore = CreateObject("EasyMail.MailStore")
ret = objMailStore.OpenStore("c:\", 0)
ret = objMailStore.SelectFolder("Inbox", 0, 0) 
objMailStore.MoveFirst 0
set env = objMailStore.Envelope
data = "Date: " & env.DateAdded  & vbcrlf 
data = data & "From: " & env.FromAddr & vbcrlf 
data = data & "Attachments: " & env.AttachmentCount
data = data & vbcrlf 
data = data & "Subject: " & env.Subject 
MsgBox data	
objMailStore.CloseStore

One of the really cool features of the EasyMail MailStore object is the way that it allows you to list the stored messages.  The Envelope property of the EasyMail MailStore object, provides quick access to the basic message information that we would normally want to display in a list box for the user.  i.e. subject, date, priority, etc...

I am just skimming the surface of the EasyMail MailStore object here.  If your e-mail application needs to store messages locally, you owe it to yourself to explore its capabilities further.  More information can be found here on our website.

Conclusion...

As I said in the beginning, POP3 is pretty easy once you know how the protocol operates.  A reliable set of e-mail components, such as the EasyMail Objects is also a must.  In addition to what I have demonstrated in this article, the EasyMail Objects will enable your application to send and print e-mail messages too. 

I hope you found this article informative and useful.  If you have any questions, comments or suggestions, please let me know. My contact information is below.

 


John Alessi has specialized in e-mail development for the past 6 years and has helped many large companies such as Microsoft, Boeing and EarthLink with their e-mail needs. He can be reached at john@quiksoftcorp.com.  Quiksoft, founded in 1994, helps companies design and build e-mail systems by providing reliable tools, consulting and programming services.

Page Navigator: << Back, 1, 2, 3, 4, 5


In This Issue:

Learn the secrets of building a successful POP3 application. 

Plus:
Downloadable code to get you started right away


This Issue's Poll:

What are your plans for developing IMAP Applications?

Currently developing
Within 90 days
Within 12 months
Within 5 years
No plans


Signup for this Newsletter:

CRITICAL tips and tricks for e-mail developers


Quiksoft News:

For a limited time, Quiksoft is enabling developers to license the SMTP portion of EasyMail .Net Edition separately.



Customer Comments

"Quiksoft's technical support is excellent. I wish all of our vendors were as responsive and helpful with technical support requests. "

"It paid for itself just after this project."

"I think your product is fantastic. The documentation is clear and consise."

Read More...


E-mail this newsletter to a friend or to yourself:

Unsubscribe...

Printer Friendly Version...

©2003 Quiksoft Corporation. All rights reserved. Unauthorized duplication or distribution prohibited. Quiksoft, EasyMail, EasyMail Objects, EasyMail .Net Edition, EasyMail Advanced API, EasyMail SMTP Express, and MailStore are trademarks of Quiksoft Corporation. Other trademarks mentioned are the property of their legal owner.
©2010 Quiksoft Corporation. All rights reserved. Terms of Use, Privacy Statement, Trademarks