Benoit Tellier created JAMES-3369:
-------------------------------------
Summary: Email/get 14. bodyStructure property
Key: JAMES-3369
URL: https://issues.apache.org/jira/browse/JAMES-3369
Project: James Server
Issue Type: New Feature
Components: JMAP
Reporter: Benoit Tellier
Assignee: Antoine Duprat
## What
Allow a completedescription of the mime structure of this message
## The spec
- bodyStructure: EmailBodyPart (immutable) This is the full MIME structure of
the message body, without recursing into message/rfc822 or message/global
parts. Note that EmailBodyParts may have subParts if they are of type
multipart/*.
And ...
{code:java}
An EmailBodyPart object has the following properties:
- partId: String|null Identifies this part uniquely within the Email. This is
scoped to the emailId and has no meaning outside of the JMAP Email object
representation. This is null if, and only if, the part is of type multipart/*.
- blobId: Id|null The id representing the raw octets of the contents of the
part, after decoding any known Content-Transfer-Encoding (as defined in
[@!RFC2045]), or null if, and only if, the part is of type multipart/*. Note
that two parts may be transfer-encoded differently but have the same blob id if
their decoded octets are identical and the server is using a secure hash of the
data for the blob id. If the transfer encoding is unknown, it is treated as
though it had no transfer encoding.
- size: UnsignedInt The size, in octets, of the raw data after content
transfer decoding (as referenced by the blobId, i.e., the number of octets in
the file the user would download).
- headers: EmailHeader[] This is a list of all header fields in the part, in
the order they appear in the message. The values are in Raw form.
- name: String|null This is the decoded filename parameter of the
Content-Disposition header field per [@!RFC2231], or (for compatibility with
existing systems) if not present, then it’s the decoded name parameter of the
Content-Type header field per [@!RFC2047].
- type: String The value of the Content-Type header field of the part, if
present; otherwise, the implicit type as per the MIME standard (text/plain or
message/rfc822 if inside a multipart/digest). CFWS is removed and any
parameters are stripped.
- charset: String|null The value of the charset parameter of the Content-Type
header field, if present, or null if the header field is present but not of
type text/*. If there is no Content-Type header field, or it exists and is of
type text/* but has no charset parameter, this is the implicit charset as per
the MIME standard: us-ascii.
- disposition: String|null The value of the Content-Disposition header field
of the part, if present; otherwise, it’s null. CFWS is removed and any
parameters are stripped.
- cid: String|null The value of the Content-Id header field of the part, if
present; otherwise it’s null. CFWS and surrounding angle brackets (<>) are
removed. This may be used to reference the content from within a text/html body
part HTML using the cid: protocol, as defined in [@!RFC2392].
- language: String[]|null The list of language tags, as defined in
[@!RFC3282], in the Content-Language header field of the part, if present.
- location: String|null The URI, as defined in [@!RFC2557], in the
Content-Location header field of the part, if present.
- subParts: EmailBodyPart[]|null If the type is multipart/*, this contains
the body parts of each child.
{code}
## DOD
As a client, I am able to fetch the `bodyStructure` properties of Email
## Example
Given the following message:
{code:java}
- partId1 multipart/mixed
- partId2 multipart/altenative
- partId3 text/plain `First part`
- partId4 text/html 'First <b>part</b>`
- partId5 text/plain `Second part`
- partId6 text/html `<b>Third</b> part`
{code}
Executing the following request:
{code:java}
{
"using": [
"urn:ietf:params:jmap:core",
"urn:ietf:params:jmap:mail"],
"methodCalls": [[
"Email/get",
{
"accountId":
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
"ids": ["3647"],
"properties": ["bodyStructure"]
},
"c1"]]
}
{code}
Will return
{code:java}
{
"sessionState": "75128aab4b1b",
"methodResponses": [[
"Email/get",
{
"accountId":
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
"state": "000001",
"list": [
{
"id": "3647",
"bodyStructure": {
"partId": "partId1",
"type": "multipart/mixed",
"blobId": "3647",
// ....
"subParts": [
{
"partId": "partId2",
"type": "multipart/altenative",
//...
"subParts": [
{
"partId": "partId3",
"type": "text/plain",
//...
},
{
"partId": "partId4",
"type": "text/html",
//...
}
]
},
{
"partId": "partId5",
"type": "text/plain",
//...
},
{
"partId": "partId6",
"type": "text/html",
//...
},
],
}
}
],
"notFound": []
},
"c1"]]
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]