Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am writing an application which reacts to emails sent to a mailbox. It retrieves the emails via IMAP. It will be deployed to a number of systems where I do not control the mail server configuration.

I would like to use IMAP flags to indicate which messages have been handled. Are the system flags sufficiently widely supported that I can reasonably depend on them in my application? Are user-defined flags sufficiently widely supported?

(If the answer is "ha ha, not a chance", then I shall use folders instead.)

Thanks

-Ben

share|improve this question
add comment

2 Answers

Take a look at this collection of example IMAP server sessions. Essentially whenever you see PERMANENTFLAGS contain \*, the server will support user-defined flags.

To add to that list, here is an excerpt from a Gimap (Google Mail IMAP) session:

* OK Gimap ready for requests from 192.0.2.1 5if380490pzk.17
a login username password
* CAPABILITY IMAP4rev1 UNSELECT LITERAL+ IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE
a OK username@gmail.com authenticated (Success)
b select inbox
* FLAGS (\Answered \Flagged \Draft \Deleted \Seen)
* OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)]
* OK [UIDVALIDITY 2]
* 1089 EXISTS
* 0 RECENT
* OK [UIDNEXT 2371]
b OK [READ-WRITE] inbox selected. (Success)
c logout
* BYE LOGOUT Requested
c OK 73 good day (Success)

And similarly, a session from Exchange 2007:

* OK Microsoft Exchange Server 2007 IMAP4 service ready
00000000 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI IDLE NAMESPACE LITERAL+
00000000 OK CAPABILITY completed.
   [...]
00000003 SELECT INBOX
* 1 EXISTS
* 0 RECENT
* FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
* OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags
* OK [UIDVALIDITY 472] UIDVALIDITY value
* OK [UIDNEXT 7] The next unique identifier value
00000003 OK [READ-WRITE] SELECT completed.

I was unable to find a session from Exchange 2010.

So it's not universal -- with Exchange being the notable abstainer -- but it sure is more common than not.

share|improve this answer
add comment

Exchange 2010 has the same set of PERMANENTFLAGS

* OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Perman
ent flags
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.