Question

We are are setting a the IMAP flags using the Java Mail API. Is there is a way to look at these flags in Thunderbird or other client for debugging purposes?

Was it helpful?

Solution

You can learn enough of IMAP to use socat to try yourself. Here's a sample exchange, I've marked my input with >, and responses with <:

$ socat READLINE ssl:imap.gmail.com:993,verify=0,crlf
< * OK Gimap ready for requests from [ip]
> a LOGIN user@gmail.com password
< * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH
< a OK user@gmail.com User authenticated (Success)

> a SELECT INBOX
< * FLAGS (\Answered \Flagged \Draft \Deleted \Seen $Forwarded)
< * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen $Forwarded \*)] Flags permitted.
< * OK [UIDVALIDITY 7] UIDs valid.
< * 836 EXISTS
< * 0 RECENT
< * OK [UIDNEXT 36515] Predicted next UID.
< * OK [HIGHESTMODSEQ 3346208]
< a OK [READ-WRITE] INBOX selected. (Success)

> a FETCH 810:820 (FLAGS)
< * 810 FETCH (FLAGS (\Flagged))
< * 811 FETCH (FLAGS ())
< * 812 FETCH (FLAGS (\Seen))
< * 813 FETCH (FLAGS (\Seen))
< * 814 FETCH (FLAGS (\Seen))
< * 815 FETCH (FLAGS (\Seen))
< * 816 FETCH (FLAGS (\Seen))
< * 817 FETCH (FLAGS ())
< * 818 FETCH (FLAGS ())
< * 819 FETCH (FLAGS ())
< * 820 FETCH (FLAGS ())
< a OK Success

> a LOGOUT
< * BYE LOGOUT Requested
< a OK 73 good day (Success)

You will want to at least skim RFC 3501, so that you understand UIDs and message sequence numbers, and section 6.4.5 will tell you the various things you can ask for in a FETCH command, such as flags, envelope, etc.

Each command is preceded by an arbitrary tag. I've used just a in the examples. It's intended to allow pipelining of commands and responses, so that they can be matched up.

The LOGIN command is just the username and password, and SELECT INBOX chooses the mailbox for the following commands to use. FETCH takes a sequence list (in the example, I said messages with sequence numbers between 810 and 820, and a list of items to fetch, in this case, just the flags.

OTHER TIPS

Get Trojitá, it shows e-mail flags by default. I have no idea how to configure other MUAs to do the same, but I suspect many of them can do this for you as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top