Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Get message bodies along with metadata #50

@Danita

Description

@Danita

As discussed in the mailing list (https://groups.google.com/forum/#!topic/elasticinbox/LW6DGE157HA) it might be necessary to provide a method to retrieve message bodies along with their metadata when requesting a message listing.

Rationale: We've discovered a common use case when developing a client for ElasticInbox where we need to show a small excerpt of each message listed on the mailbox. In such instance currently are needed 1 + n requests, where n is the number of messages displayed per page. The first request is for retrieving the list, the remaining n requests are for retrieving each and every message body. This is inefficient. If ElasticInbox could be configured to return the bodies along with the metadata the requests could be cut to just 1.

Proposal:

  • Add a includebodies=true parameter to the listing url.
  • includebodies will not have effect if metadata=true is not present.
  • It could be beneficial to configure ElasticInbox to truncate the bodies to a specified length. Note that this could result in invalid HTML output due to missing closing tags.

Example request:

http://mail.example.com/rest/v2/example.com/danita/mailbox/label/1?metadata=true&includebodies=true

Example response:

{
    944e8900-6382-11e3-852b-22000a9887a0: {
        from: [
            { name: "Example.com", address: "[email protected]" }
        ],
        to: [
            { name: "Danita", address: "[email protected]" },

        ],
        cc: null,
        bcc: null,
        subject: "Newsletter #661",
        date: "2013-12-12T18:46:15.000+0000",
        messageId: null,
        size: 22336,
        location: "blob://db/944e8900-6382-11e3-852b-22000a9887a0?c=dfl&b=1",
        plainBody: "Newsletter #661: Principles of interaction design...",
        htmlBody: "<html><head></head><body><h1>Newsletter #661: Principles of interaction design</h1><p>...</p></body></html>",
        labels: [ 0, 1, 10 ],
        markers: [ "SEEN" ],
        parts: null
    },
    ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions