Open SoulfreezerXP opened 9 years ago
Hi!
When you call folder::close() with "expunge" set to true, it won't call the EXPUNGE command, it will simply call the CLOSE command. Here is what the IMAP RFC says about it:
The CLOSE command permanently removes from the currently selected
mailbox all messages that have the \Deleted flag set, and returns
to authenticated state from selected state. No untagged EXPUNGE
responses are sent.
So it seems your server does not totally support the CLOSE command, but I couldn't find anything confirming this...
As for marking the messages as seen, simply call message::setFlags() on a single message, or folder::setMessageFlags() for several messages at once, the flag to set is message::FLAG_SEEN.
Vincent
Thnx! Maybe my Server is not correct configured. The explicit "expunge()"- call will work in my special-case :)
Hi Vincent,
now I have another problem here. I call here in my example above the expunge-function explicit. The exchange-server doesn't execute it implicitly on close(), even though the RFC instructs it. I have verified this!
But now, If I have MORE than one mail on the exchange-server, I earn an exception when fetching the second mail. I think when marking the first mail as deleted and expunge it directly, the next sequence-number for the getMessage()-function is invalid or something?! Can you help me again here out? Is it the correct behavior and when yes, how can I workarround this problem? I need the generic for-loop, because I use it in a polymorph way also for the POP3-Accounts! I do not want implement specific code for each protocol-type.
imap:2->a004 OK AUTHENTICATE completed. imap:2->(Client)a005 LIST "" "" imap:2->* LIST (\Noselect \HasChildren) "/" "" imap:2->a005 OK LIST completed. imap:1->(Client)a006 CAPABILITY imap:1->* CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN UIDPLUS CHILDREN IDLE NAMESPACE LITERAL+ imap:1->a006 OK CAPABILITY completed. imap:2->(Client)a006 SELECT INBOX imap:2->* 2 EXISTS imap:2->* 2 RECENT imap:2->* FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent) imap:2->* OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags imap:2->* OK [UNSEEN 1] Is the first unseen message imap:2->* OK [UIDVALIDITY 102102] UIDVALIDITY value imap:2->* OK [UIDNEXT 26] The next unique identifier value imap:2->a006 OK [READ-WRITE] SELECT completed. imap:2->(Client)a007 CAPABILITY imap:2->* CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN UIDPLUS CHILDREN IDLE NAMESPACE LITERAL+ imap:2->a007 OK CAPABILITY completed. imap:2->(Client)a008 STATUS INBOX (MESSAGES UNSEEN UIDNEXT UIDVALIDITY) imap:2->* STATUS INBOX (MESSAGES 2 UNSEEN 2 UIDNEXT 26 UIDVALIDITY 102102) imap:2->a008 OK STATUS completed.
(MY DEBUG --> value of unseen-variable: 2)
imap:2->(Client)a009 FETCH 1 BODY[]
imap:2->* 1 FETCH (BODY[] {2467}
imap:2->{...2467 bytes of data...}
imap:2-> FLAGS (\Seen \Recent))
imap:2->a009 OK FETCH completed.
Received: from xxxx.xxxx.de ([fe80:8:bbee:53b3]) by
xxxx.xxxx.de ([fe80::d9fd:bee:53b3%14]) with mapi id
14.03.0123.003; Mon, 11 May 2015 15:37:32 +0200
From: "xxx"
.... ....
imap:2->(Client)a010 STORE 1 +FLAGS (\Deleted) imap:2->* 1 FETCH (FLAGS (\Seen \Deleted \Recent)) imap:2->a010 OK STORE completed. imap:2->(Client)a011 EXPUNGE imap:2->* 1 EXPUNGE imap:2->* 1 EXISTS imap:2->a011 OK EXPUNGE completed. imap:2->(Client)a012 LOGOUT imap:2->(Client)Disconnecting imap:1->(Client)a007 LOGOUT imap:1->(Client)Disconnecting Ex: message_not_found->Message not found.
Hi Vincent,
I have a question to IMAP. I am fetching "unseen" mails from an IMAP-Exchange-Server. In my fetching-loop I am deleting each mail, cause in another run I do not want fetch them again. I wonder, why there is no "expunge" called, when closing the folder. I have added a "true" to the close-parameter. If I explicitly call "expunge()" from the folder-class, it works fine. Is this ok? Should the user call "expunge()" explicit from the folder-class?
Then I have another question. How can I tag the fetched mails as "SEEN" instead of deleting them?
--> Thanx for your super support! <--
Without explicit "EXPUNGE"
... ... imap:2->(Client)a010 STORE 1 +FLAGS (\Deleted) imap:2->* 1 FETCH (FLAGS (\Seen \Deleted)) imap:2->a010 OK STORE completed. imap:2->(Client)a011 CLOSE imap:2->(Client)a012 LOGOUT imap:2->(Client)Disconnecting imap:1->(Client)a007 LOGOUT imap:1->(Client)Disconnecting
With explicit "EXPUNGE"
imap:2->(Client)a010 STORE 1 +FLAGS (\Deleted) imap:2->* 1 FETCH (FLAGS (\Seen \Deleted)) imap:2->a010 OK STORE completed. imap:2->(Client)a011 EXPUNGE imap:2->* 1 EXPUNGE imap:2->* 1 EXISTS imap:2->a011 OK EXPUNGE completed. imap:2->(Client)a012 CLOSE imap:2->(Client)a013 LOGOUT imap:2->(Client)Disconnecting imap:1->(Client)a007 LOGOUT imap:1->(Client)Disconnecting
Minimal example:
Maybe this the relevant Code-Fragment from the VMIME-Lib?