jstedfast / MailKit

A cross-platform .NET library for IMAP, POP3, and SMTP.

Home Page:http://www.mimekit.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Timeframe of Recent Flag

Pieeer1 opened this issue · comments

I could not find any documentation on this, what is the timeframe of the flag:
SearchQuery.Recent
Is this dependent on the mailbox type or is this a pretty static value? If so, what are we looking at, a certain amount of emails at the top of the queue, or messages within a certain timeframe?

Additionally, if there is some documentation I missed on this a link would be super appreciated.

I'm going to link the the IMAP protocol specification to avoid explaining it incorrectly:

https://www.rfc-editor.org/rfc/rfc3501#section-2.3.2

Personally, I think the \Recent flag semantics are poorly designed and would recommend not depending on that flag.

Appreciate the response! I have decided to go down a different route, I essentially need to get the count of messages in the last 24 hours and was thinking about using that flag. Since I do not have the ability to run SearchQuery.YoungerThan on my mailbox I need a method to do that so I am now fetching all of the headers. Unfortunately it is taking too much time so I will still have to look for alternative solutions. Appreciate all the help!

@Pieeer1 If this is something your program will do on a regular basis, you can keep track of the last UID that your program has seen and just do SearchQuery.All and then take just the UIDs > lastUidSeen.

Yeah unfortunately I am trying to keep it lightweight and database free so I can just use the service to read IF the count in the sent folder over the last 24h >= 10k so we can bypass the outlook sending limits by switching to a different account, and we would have to do this for multiple accounts