IMAP4 Extension: Message Preview Generation
Extracted elements (20)
Server-side preview generation is preferred over client-side because: (1) it enables consistent representation across all clients; (2) it is more efficient — client-side requires non-pipelineable FETCH BODYSTRUCTURE then FETCH BODY commands; (3) it enables centralized caching so preview is generated once per message for its entire retention period.
The 200/256 character limits for preview text were chosen to balance support for various languages with different average word lengths and diverse client display size requirements, while hard-capping at 256 to bound server resource use.
The relaxed immutability requirement (servers SHOULD strive for consistent previews but clients MUST NOT assume immutability) permits servers to offer previews without burdensome storage or processing guarantees, since preview approximation does not require the strictness of canonical message content.
When preview is not generated from message body content and the LANGUAGE extension (RFC 5255) is supported, the preview text SHOULD be generated according to language rules for human-readable text, enabling appropriate localization of auto-generated descriptions (e.g., for image-only messages).
A client MUST NOT assume that a message preview is immutable for a given message, since previews are an approximation and server implementations may change over time.
A client SHOULD NOT continually issue FETCH PREVIEW requests with the LAZY modifier in a selected mailbox, as the server is under no requirement to return preview information for this command, which could waste system and network resources.
A server MUST NOT return NIL to a FETCH PREVIEW request made without the LAZY modifier. NIL is only permitted as a response when the LAZY modifier is used and preview generation would cause undue delay.
It is RECOMMENDED that FETCH requests for unavailable previews (those returned NIL under LAZY) be issued in small batches, e.g., 50 messages per FETCH command, since preview generation may be expensive.
Preview text MUST be treated as text/plain media type data by the client, MUST NOT be content transfer encoded, and MUST be encoded in UTF-8.
The LAZY modifier MUST be implemented by any server that supports the PREVIEW extension.
The server MUST NOT output preview text longer than 256 preview characters, where a preview character is a single UCS character encoded in UTF-8 (which may comprise multiple octets).
The server SHOULD limit preview text length to 200 preview characters to support various languages and diverse client display size requirements.
The server SHOULD remove formatting markup (e.g., HTML tags) and perform processing useful for rendering the preview as plain text.
When no meaningful preview can be generated (e.g., for encrypted messages or unsupported content types), the server MUST return a zero-length string. Clients SHOULD NOT send another FETCH for a preview for such messages.
The LAZY modifier directs the server to return the preview only if it can be provided without undue delay. If the server cannot comply without undue delay, it MUST return NIL. The LAZY modifier MUST be implemented by any server that supports the PREVIEW extension.
The PREVIEW FETCH attribute is a new IMAP FETCH data item that clients use to request a server-generated abbreviated text preview of a message. The server returns a variable-length string intended for display to the user as contextual preview of the entire message.
IANA has added the "PREVIEW" capability to the IMAP Capabilities registry. IMAP capabilities are registered by publishing a Standards Track or IESG-approved Experimental RFC.
If generated preview data is stored on the server for caching, these previews MUST be protected with equivalent authorization and confidentiality controls as the source message, since previews may contain sensitive information.
Preview generation may enable denial-of-service attacks via excessive memory, CPU, or storage usage. Servers SHOULD log the client authentication identity on FETCH PREVIEW operations to facilitate tracking of abusive clients, and MAY limit resources used for preview generation.
The PREVIEW FETCH attribute syntax is defined as: fetch-att =/ "PREVIEW" [SP "(" preview-mod *(SP preview-mod) ")"]. The response uses msg-att-dynamic =/ "PREVIEW" SP nstring, where nstring allows NIL (only when LAZY is used). The only defined modifier is "LAZY".