What's the difference between "UNKEYWORD \Seen" and "UNSEEN"?
Hi everyone,
These two IMAP search commands return different values:
a SEARCH UNSEEN
- SEARCH 38 61 62 63 65 69 74 75 76 82 86 87 102 120 121 141 142 143 144 145 146 158 159 160
a SEARCH UNKEYWORD \Seen
- SEARCH [All email IDs in the mailbox]
a SEARCH KEYWORD \Seen
- SEARCH [Empty]
According to RFC 3501 <https://datatracker.ietf.org/doc/html/rfc3501#section-6.4.4>, in my interpretation, these two should be equal:
UNSEEN Messages that do not have the \Seen flag set.
Can you tell me what is causing this difference? I also ran force-resync on all my mails, just to be sure.
Ákos
Hi everyone,
These two IMAP search commands return different values:
a SEARCH UNSEEN
- SEARCH 38 61 62 63 65 69 74 75 76 82 86 87 102 120 121 141 142 143 144 145 146 158 159 160
a SEARCH UNKEYWORD \Seen
- SEARCH [All email IDs in the mailbox]
a SEARCH KEYWORD \Seen
- SEARCH [Empty]
According to [1]RFC 3501, in my interpretation, these two should be equal:
UNSEEN Messages that do not have the \Seen flag set.
Can you tell me what is causing this difference? I also ran force-resync on all my mails, just to be sure.
Akos
References
Visible links
On 25/08/2025 12:48, Ákos Szőts via dovecot wrote:
Hi everyone, These two IMAP search commands return different values: a SEARCH UNSEEN * SEARCH 38 61 62 63 65 69 74 75 76 82 86 87 102 120 121 141 142 143 144 145 146 158 159 160 a SEARCH UNKEYWORD \Seen * SEARCH [All email IDs in the mailbox] a SEARCH KEYWORD \Seen * SEARCH [Empty] According to [1]RFC 3501, in my interpretation, these two should be equal: > UNSEEN > Messages that do not have the \Seen flag set. Can you tell me what is causing this difference? I also ran force-resync on all my mails, just to be sure. Akos
Hi Akos
keywords are a specific type of flag. As defined by the RFC:
A keyword is defined by the server implementation. Keywords do not begin with "\".
My interpretation is that for searching for \Seen or \Unseen you should use the SEEN or UNSEEN search criteria and not the KEYWORD or UNKEYWORD criteria.
John
On 25/08/2025 12:48, Akos Szo"ts via dovecot wrote:
Hi everyone,
These two IMAP search commands return different values:
a SEARCH UNSEEN
* SEARCH 38 61 62 63 65 69 74 75 76 82 86 87 102 120 121 141 142 143 144
145 146 158 159 160
a SEARCH UNKEYWORD \Seen
* SEARCH [All email IDs in the mailbox]
a SEARCH KEYWORD \Seen
* SEARCH [Empty]
According to [1]RFC 3501, in my interpretation, these two should be equal:
> UNSEEN
> Messages that do not have the \Seen flag set.
Can you tell me what is causing this difference? I also ran force-resync
on all my mails, just to be sure.
Akos
Hi Akos
keywords are a specific type of flag. As defined by the RFC:
A keyword is defined by the server implementation. Keywords do not begin with "\".
My interpretation is that for searching for \Seen or \Unseen you should use the SEEN or UNSEEN search criteria and not the KEYWORD or UNKEYWORD criteria.
John
keywords are a specific type of flag. As defined by the RFC:
A keyword is defined by the server implementation. Keywords do not begin with "\".
My interpretation is that for searching for \Seen or \Unseen you should use the SEEN or UNSEEN search criteria and not the KEYWORD or UNKEYWORD criteria.
Hi John,
This piece of information was missing for me; that explains it, thank you!
Ákos
participants (2)
-
John Fawcett
-
Ákos Szőts