Re: How do you filter the email headers you read from an email folder?



Hi,

I haven't received any replies to this request for information - can
anyone possibly help to answer it?

Thank you,
Steve Rosen

Steve Rosen wrote:
Hi All,

I have developed a nice little console application that can monitor the
incoming emails for some folder (in this case, just the inbox folder for
now) - it uses the TinyMail library to do the brunt of the work.

Here's my question - Is there any way to provide a filter that will limit
the headers that are retrieved from the email server?

For example, a lot of people will have an inbox folder that has, literally, thousands and thousands of messages (going back many years, in some cases) - my current strategy is to simply retrieve all the headers, and before I try to save off anything that I care about, I make sure the date in the header is greater than some specified date in the past (for example, one month ago).

But - if the inbox folder I am monitoring has thousands and thousands of
emails, I will receive thousands and thousands of email headers, and only
choose to keep a few dozen (or, however many were sent in just the last month).

So I'm looking for some way, using the TinyMail APIs, to provide that filtering at a lower level, i.e., make sure that my little device (which wants to keep bandwidth to an absolute minimum) only tries to retrieve email headers from the server that are not older than (in this example) just one month from today.

Is this possible?  If so, how?

To be a bit more specific about what I am doing, I have a newly created folder monitoring object ("TnyConsoleFolderMonitor") - and when its update method gets called, it checks to see if it's the FIRST time it is being called - in this special first-time case, it then calls the "tny_folder_get_headers_async" method,
which will retrieve ALL the headers of the inbox folder I am monitoring.

On subsequent calls, it calls the "tny_folder_change_get_changed" method to see if there are any ADDED headers and/or EXPUNGED headers, and then calls the appropriate methods ("tny_folder_change_get_added_headers" method and/or "tny_folder_change_get_expunged_headers" method) to get the list of newly added headers and/or the list of newly expunged headers. Of course, once we're past that the point of receiving the initial email headers, these report-by-exception methods are great, since you just get the NEW information about the folder that
has changed.

My problem is that first-time, initial setting up of the emails that are in the inbox folder I am monitoring - I really don't want the device to be getting thousands and thousands of headers from the email server - this represents a large amount of bandwidth (potentially) - and certainly slows up the time that the user will be able to look at their list of email messages. We will, of course, allow the user to define just how far back they want us to go when retrieving emails - the default will be something like one month - and if the user wants to see, for example, up to one year's worth of emails from their email account, we'll allow them to do this, with ample warnings that their device will be gobbling up XXX amount of extra bandwidth to give them that
extra backlog of email messages.

Thank you in advance for any help that you can provide on this issue.

- Steve Rosen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]