Skip to content

Mail: Add attachments when writing emails #1479

Closed

Description

@kulmann

Initial Checklist

  • I understand this is a user story and questions should be posted in the Community Discussions
  • I searched issues and couldn’t find anything (or linked relevant results below)

User Story

  • As a user, I want to add file attachments from my device to the email so that I can send files.

User Value

Writing comprehensive email

Acceptance Criteria

  • Email composer footer has a button for adding attachments (paperclip icon)
  • clicking the paperclip button opens an upload context menu / bottom drawer
  • Attachment gets added as blob to the draft (? clarify with Pascal)
  • Attachments can be removed from the draft again by clicking their respective delete button
  • re-use the attachments card for visualising already added attachments
  • not supported in this first iteration:
    • drag & drop
    • copy & paste
    • inline attachments
Image Image

Activity

  1. moved this from Qualification to Backlog in OpenCloud Team Boardon Oct 29, 2025
  2. added theissue type on Oct 30, 2025
  3. pbleser-oc commented on Nov 17, 2025

    @pbleser-oc
    Member

    Attachments need to be uploaded to the Groupware API and then referenced in the Email (draft) object through its blobId (which you get back from the Groupware API.)

    Metadata about the attachment, notably the MIME type, must be indicated in the Email object where the blobId is referenced.

    API to upload a blob:
    POST /groupware/accounts/{accountId}/blobs
    (added with opencloud-eu/opencloud@0bf485e)

    The request may set the Content-Type header if possible.

    It returns the following JSON response:

    {
      "blobId": "...",
      "size": 12345,
      "type": "application/pdf"
    }

    (Where type is just the same as the Content-Type that was set in the request header, JMAP blobs don't actually have any associated metadata -- see below.)

    For example:

    oc-gw POST /groupware/accounts/_/blobs Content-Type:image/png < ./opencloud_logo.png

    yields this response:

    {
        "blobId": "ecfpcnaf1awj0dex3t9u0ourvx17cwzxna9effbj7ohat90u01pc7aoputwmqbq",
        "size": 12762,
        "type": "image/png"
    }

    Those attachments are then referenced in the Email (draft) object, like this:

    {
      ...
      "attachments": [
        {
          "blobId": "ecfpcnaf1awj0dex3t9u0ourvx17cwzxna9effbj7ohat90u01pc7aoputwmqbq",
          "name": "opencloud_logo.png",
          "type": "image/png",
          "disposition": "attachment"
        }
      ],
      ...
    }

    Notice the separation of

    • the raw data itself, that is stored in a blob, of which you only have the blobId
    • metadata such as the filename (name) and MIME type (type), that are in the attachment object in the Email instead, together with that blobId

    Note that there is no API to delete or update/replace blobs, as they are immutable and garbage collected by the server.

    It is however possible to "drop" an attachment, simply be removing the corresponding attachment object from the attachments array in the Email object:

    • the user uploads a PDF file
    • the file is stored as a blob in the Groupware backend
    • the UI gets back a blobId
    • the UI adds an attachment object to the Email object's attachments property, putting that blobId in there, along with the filename and MIME type
    • later, the user removes that attachment in the composition screen in the UI
    • the UI can't delete the blob from the Groupware backend, but can simply remove that attachment object from the array in the attachments property

    For reference, and on that garbage collection: the JMAP Core specification mentions:

    Binary data is referenced by a blobId in JMAP and uploaded/downloaded separately to the core API. The blobId solely represents the raw bytes of data, not any associated metadata such as a file name or content type. Such metadata is stored alongside the blobId in the object referencing it. The data represented by a blobId is immutable.
    [...]
    A blob that is not referenced by a JMAP object (e.g., as a message attachment) MAY be deleted by the server to free up resources. Uploads (see below) are initially unreferenced blobs. To ensure interoperability:

    • The server SHOULD use a separate quota for unreferenced blobs to the account's usual quota. In the case of shared accounts, this quota SHOULD be separate per user.
    • This quota SHOULD be at least the maximum total size that a single object can reference on this server. For example, if supporting JMAP Mail, this should be at least the maximum total attachments size for a message.
    • When an upload would take the user over quota, the server MUST delete unreferenced blobs in date order, oldest first, until there is room for the new blob.
    • Except where quota restrictions force early deletion, an unreferenced blob MUST NOT be deleted for at least 1 hour from the time of upload; if reuploaded, the same blobId MAY be returned, but this SHOULD reset the expiry time.
    • A blob MUST NOT be deleted during the method call that removed the last reference, so that a client can issue a create and a destroy that both reference the blob within the same method call.
  4. self-assigned this
    on Jan 12, 2026
  5. moved this from Backlog to In Progress in OpenCloud Team Boardon Jan 16, 2026
  6. moved this from In Progress to Done in OpenCloud Team Boardon Jan 28, 2026
  7. closed this as completedby moving to Done in OpenCloud Team Boardon Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions