Is there a Function i can use in IMAP to get all mails where the UID is greater then a given UID? Or how can i write a logic that i don't have to download all the Mails(Header) from Server and compare all the UID's localy? And how can i do the same Functionality in POP3??
I wanna use this in Android
asked Dec 14 '15 at 08:05
I see now. In this case, you should consider the possibility that the IMAP server is at fault. You can see the exact command and response -- the IMAP server should not have responded with a UID smaller than 79.
I don't understand why people consider servers infallible. Maybe this particular server has a bug. If not, then the question is "How do I correctly construct the IMAP SEARCH criteria?" Chilkat simply passes the SEARCH criteria string (provided by the application) directly into the SEARCH command. If your app passes "poodle doodle 123" to the Search method, then you would see in the log:
ImapCmdSent: aad UID SEARCH poodle doodle 123So the question is: Is the criteria "UID 79:*" the correct criteria string for requesting all UIDs at 79 and above? To answer that, you have to go to RFC 3501. The grammar for the SEARCH command is this horrible mess:
search = "SEARCH" [SP "CHARSET" SP astring] 1*(SP search-key) ; CHARSET argument to MUST be registered with IANAWe want the "UID" criteria, so we need to know exact what the heck a "sequence-set" is...
sequence-set = (seq-number / seq-range) ("," sequence-set) ; set of seq-number values, regardless of order. ; Servers MAY coalesce overlaps and/or execute the ; sequence in any order. ; Example: a message sequence number set of ; 2,4:7,9,12: for a mailbox with 15 messages is ; equivalent to 2,4,5,6,7,9,12,13,14,15 ; Example: a message sequence number set of :4,5:7 ; for a mailbox with 10 messages is equivalent to ; 10,9,8,7,6,5,4,5,6,7 and MAY be reordered and ; overlap coalesced to be 4,5,6,7,8,9,10.A seq-range is this:
seq-range = seq-number ":" seq-number ; two seq-number values and all values between ; these two regardless of order. ; Example: 2:4 and 4:2 are equivalent and indicate ; values 2, 3, and 4. ; Example: a unique identifier sequence range of ; 3291:* includes the UID of the last message in ; the mailbox, even if that value is less than 3291.And according to this your SEARCH criteria string is correct and valid, and therefore the IMAP server must be at fault.
Chilkat passes the raw search criteria to the server, and gets a response -- so the only way Chilkat can be defective is if it's not sending the command that was asked to be sent. So Chilkat is OK in this respect.
If the server is behaving correctly, then it can only be that our understanding of how to form the correct search criteria is incorrect. After re-reading the RFC specification, I think I see the issue and our misunderstanding:
; Example: a unique identifier sequence range of ; 3291:* includes the UID of the last message in ; the mailbox, even if that value is less than 3291.Notice the clause "even if that value is less than 3291". So the search criteria "UID 79:*" returns all UIDs 79 and above INCLUDING the very last UID regardless of its value. (Ughh!) So it must mean that 78 was the last email in the mailbox. A program would need to understand that the message set returned might contain a single UID that is less than 79.
OKAY... i now think i need Professional Help from Chilkat Team :-)
after working a while with the Solution from above now i don't get again the right number of new mails :-( If i have NO new Mails on a Mailbox i get back 1 "new" Mail but this is just the Mail with the highest UUID... not really a NEW Mail. Ma Last UUID was 78 and i get back this Mail:
BUT ... if the MailBox has really a NEW Mail i got THIS back (a Mail with UUID 85)
what i have to do to get only NEW Mails and get nothing if i have no new Mails in the Mailbox?? Or is this not possible??
answered Jan 18 '16 at 05:43
Couple of things first - Is this for POP3 or IMAP that you are trying to get unread messages? If POP3, then according to this document: http://www.example-code.com/vb6/pop3_unread.asp POP3 doesn't support getting unread messages:
However, you may be able to "fudge" it using the provided example code at that link.
For IMAP - having you tried using the Search metghod with the NEW criteria as described in the reference documentation for the Search method?
Lastly, remember that this is a user-user help forum, not an official support channel, so if you need "professional" support you should use the official support email address if you have an active support license (or if not, you should consider purchasing one). More information on Chilkat support is available here: https://www.chilkatsoft.com/support.asp
answered Jan 18 '16 at 10:27
okay first of all thanks for your answer.
second: sorry for making things not so clear that i'm talking in my last Post about IMAP. You could see this on the LogFiles i posted above but i should be more clear.!!
When we talking about IMAP the things are not that easy like you describe. In my case i never get a Mail with the "Recent flag" so i can't use the Search Method with the "NEW criteria". But what i do NOW is just to ignore the Fetched Mail if the UUID is the same like my LAST UUID in my local DB. I was hoping there is another way...
I thought this Forum is also Supported by Chilkat and u also see a lot of Answers from them. Also i think other User may are interested on things like i ask... that's why i use this Forum. And btw. i HAVE a License :-D
But thanks again for your Answer
answered Jan 20 '16 at 05:06
OK, I wasn't sure since the initial post mentioned trying to use functionality similar to IMAP with POP3, so I thought there might be some confusion regarding what library classes you should be using.
My first thought is that it might be a bug in the library that has already been fixed - you are using 188.8.131.52 which is slightly out of date, so it might be worth trying the latest release and see if the problem persists.
If it is still an issue in the latest version, it's probably worth reporting directly to Chilkat at the support email address, but perhaps you could use this temporary workaround - when you get your result you can quickly compare the UID of the message to your stored most-recent UID. If they match then ignore the returned result, otherwise do your normal processing against it.
answered Jan 20 '16 at 09:11
This part of the LastErrorText is showing both the exact command and response:
Command: aaad UID SEARCH UID 79: ImapCmdSent: aaad UID SEARCH UID 79: getCompleteResponse(2ms): ImapCmdResp: * SEARCH 85 ImapCmdResp: aaad OK SEARCH completed. --getCompleteResponse numMessages: 1
Your program asks for all UID's from 79 onward, and the IMAP server responds with one UID: 85.
This is undeniable proof that only one email exists (in that particular mailbox) with a UID greater than 79. There's no bug in Chilkat here because the command and response can be clearly seen.
If you expected more emails in the response, then somehow your expectation was wrong -- there truly are no more emails having UIDs >= 79 other than the single email with UID 85.
answered Jan 20 '16 at 09:29
thanks for your response!
You are right but your example is the Log from the Case where ONE new Mail was at the Server. I also didn't say is's a Chilkat Bug. And i did not expect more than this one new Mail.
if you look at the First Log you find this:
but this is really NOT what i expected. I thought the response is NO Mail. I ask for all UID's from 79 onward but get the Mail with UID 78. This response i get if there is NO new Mail on the Server...