0

I have a Django email client powered by IMAPClient library. I successfully control read/unread status, as well as deleted. As descriped here.

My code for declaring a message as readlooks like this:

from imapclient.imapclient import SEEN
server.add_flags(msg_uids, SEEN)

Now I am stuck trying to add flag 'Junk' to the message. I mean, doing something like:

server.add_flags(msg_uids, '\Junk')
Rob
  • 14,746
  • 28
  • 47
  • 65
Edgar Navasardyan
  • 4,261
  • 8
  • 58
  • 121

1 Answers1

0

There are a few things at play here. Firstly, flags that start with "" are system flags and \Junk isn't a standard system flag (as defined here).

Are you sure the server you're talking to supports the \Junk flag? You can check what flags the server lets the client set by checking for a PERMANENTFLAGS response in the return from IMAPClient's select_folder() call. This lists the flags the client is allowed to change. Is \Junk included?

If PERMANENTFLAGS includes \* then the client is allowed to define new keywords (flags that don't start with \) just by using them. See the spec for further details. If \* isn't included then the client may only set the listed flags.

Community
  • 1
  • 1
Menno Smits
  • 2,074
  • 1
  • 13
  • 12