David J Murray Dev
~ Learn and Do - Excel and Share ~


Sep 14, 2006
You're Reading: More IMAP

I have been interfacing into MS-Exchange using UniVerse sockets and IMAP.

I have been able to obtain access to specified user mailboxes, storing the status of each in a file every 10 minutes. The results, after some weeks, are now starting to show patterns. Which days are the busiest for receiving emails and how the users respond and answer them.

I next step was to download the actual email and archive the contents. Then I can cross reference the email addresses with the customer database, enabling a log or notational history of correspondence.

But I have come across an interesting problem. The problem of lists and the decoding of such. The IMAP specification uses ‘(‘ to delimit lists of items .e.g a list of emails is wrapped in (). A list within a list is ((..)) etc. And there is also string delimiting using “..”. The actual fields are space delimited, just to make it all interesting.

This problem also crops up with CSV (Comma Separated Value) formatted data. Comma’s are used to separate fields. If a field is a text field and it has a comma, the complete field is delimited in double quotes.

So, it is not as simple as replacing all comma’s with a @FM


as the comma within a text field all be replaced with a field marker and the text field will end up split.

So, I used a turing engine to step through each character within the text string, comparing with a list of delimiters and setting/unsetting flags (state register) to break the string into fields, value and subvalues. All good stuff…

Except I keep thinking that there has to be a better way. It is similar to parsing XML, so maybe I can convert to XML and then use U2 XML to parse and convert to a record?

I need to think on this one…

About the Author

<a href="https://davidjmurray.dev/losucag/davidjmurray/" target="_self">djm</a>


I have been in the computer/IT industry for over 35 years. After spending half a life-time in highly proprietary database environments, I have succumbed to the WordPress Eco-system and I'm well down the chasm. I am specializing in AWS hosting, Wordpress CMS, Elegant Themes, in particular Divi and Extra themes.


Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This