Skip to content

Add support for IMAP keywords #607

@llemoine

Description

@llemoine

Hi,

The RFC 9051 define keywords that should be allowed to be used as flag.

Those keywords differ from system flags as they do not begin with "\".

The RFC 9051 defines the following keywords :

  • $Forwarded
  • $MDNSent
  • $Junk
  • $NotJunk
  • $Phishing

Currently, it is possible to retrieve those keywords by adding them in the list of available flags in the config,
but it is not possible to set or unset them on a message, because the character "\" is added to flags sent to the methods Message::setFlag() and Message::unsetFlag().

Proposed solution
Change the Message::setFlag() and Message::unsetFlag() methods to not add a "\" if the flag starts with "$".
This solution does not break compatibility.

Additional context
IMAP also handle the creation of custom keywords, but this is a bit more complex since custom keywords are not allowed by all servers, or on all folders.
This is defined in the PERMANENTFLAGS response code in the EXAMINE or SELECT command responses, if the special flag "\*" is present.

* OK [PERMANENTFLAGS (\Deleted \Seen \Answered \Flagged \Draft \*)]

Handling this feature would necessit more changes, as there must be a way to know if custom keywords are allowed on a folder, and a breaking change on the Message::setFlag() and Message::unsetFlag() methods to never add the "\" on flags.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions