Archived Forum Post

Index of archived forum posts


Imap, best way to read, thread, add to MS Access database, then delete?

Jan 12 '13 at 09:46

Sorry if this got asked twice, registered after & don't think got posted.

Hi, Windows 8 64 bit, Office 2007 MSAccess 2007 32bit.

Looking for a solution in Visual basic to read Imap emails & import into Access database & reply.

Only want to purchase one licence i.e. IMAP

On trial I have used an example which is working to read the emails, it uses the Bundle method but wonder if I should use the incremental email examples seen elsewhere.

Don't want someone to walk me through it but don't want to start off in the wrong direction & then find it can't do everything I would like. It mainly concerns trying to keep track of a thread, replies etc, mainly in my database but also ME putting an ID into my replies to email. Ideally into some sort of hidden header, so that if I then get another reply from the client on the same thread I can see that and copy the .body data to my original record in the database so that perhaps a 7 thread conversation is all linked. I can add something to the message body but not great for searching etc.

What I would like to do is 1) Read email, 2) copy to database, Add some sort of ID to the email, pref hidden in the header some how, big ask I know, I use CDO to send the emails so imagine very unlikely to get access to the header to change it or whether this is foolish messing with header anyway. I did see ref to addheader so seemed something that does get used? I can't justify buying 2 licences for the smtp chilkat also. 3)reply to email 4) On receipt of email, if I detect this new ID I know which database record to link it too. 5) Delete from server - Either immediately after importing or bit later, probably on same loop of reading.

Sorry for rambling message but there are some many ifs & buts not sure which direction to take.

thanks I/A.


I'm a VB6 developer (unaffiliated with Chilkat), and one thing I'd recommend is that you reconsider the decision to buy only the IMAP component. It looks like that component costs $199, and you can buy the entire bundle (all of the CK components) for $289, so only an extra $90. It is also a lifetime license for all of the components released at the time of (and I believe within a year of) your purchase. IMHO, the bundle license is an extremely good deal.

I make frequent use of the SMTP, Crypt, HTTP, ZIP and other classes, and I suspect that over time you would also find uses for more classes than just the IMAP class if you had access to them all.

Regarding your specific problem, having the SMTP class would allow you to add custom X- headers to your messages (unique ID). What you would have to test is whether or not those headers are preserved in reply e-mails. There would never be a 100% guarantee of this, as any e-mail server can modify the message header as they wish, but maybe most servers consistently pass along the custom headers, and maybe most clients include the x- headers in their replies (this of course would require some testing to verify).

I actually have a suspicion that most clients do not maintain the parent message's custom headers, so you might have to look at other options such as including an ID in the Subject, or in the message body (where you could put a little notice asking the user not to remove the ID). I've seen both of those solutions in the wild.