Benoit Tellier created MIME4J-294:
-------------------------------------

             Summary: Implement JMAP MDN draft
                 Key: MIME4J-294
                 URL: https://issues.apache.org/jira/browse/MIME4J-294
             Project: James Mime4j
          Issue Type: New Feature
          Components: jmap
            Reporter: Benoit Tellier
             Fix For: 3.7.0


h2. Why

MDN/parse allow to interpret a Mail as a **Message Delivery Notification**.

Message Disposition Notifications (MDNs) are used as "read receipts", 
"acknowledgements", or "receipt notifications". When receiving an email 
message, an MDN can be sent to the sender via the MDN/send method.


h2. How

In apache/james-project:

Write a new JMAP `Method` allowing parsing MDNs.

 - Use the `MessageIdManager` class to retrieve the mail content, 
 - Parse it as a MDN using the `/MDN` utils
 - Write the JMAP scala POJOs to represent a MDN
 - JSON serialization with Play JSON for those POJOs
 - Write integration tests for `MDN/parse`

Then contribute `MDN/send`:

The MDN/send method uses an MDN object defined in 
https://tools.ietf.org/html/draft-ietf-jmap-mdn-15.
When calling this method the "using" property of the Request object MUST 
contain the capabilities urn:ietf:params:jmap:mdn and
urn:ietf:params:jmap:mail

Write integration test to show that a request to MDN/Send method will update 
the corresponding email object.
Write integration test to show that request without the 
urn:ietf:params:jmap:mdn capability is rejected.
Write integration test to show that a MDN request to update an email which has 
the mdnsent keyword already set will return an mdnAlreadySent error.

h2. Example

{code:java}
          [[ "MDN/parse", {
            "accountId": "ue150411c",
            "blobIds": [ "0f9f65ab-dc7b-4146-850f-6e4881093965" ]
          }, "0" ]]
{code}

Will return:

{code:java}
       [[ "MDN/parse", {
         "accountId": "ue150411c",
         "parsed": {
           "0f9f65ab-dc7b-4146-850f-6e4881093965": {
             "forEmailId": "Md45b47b4877521042cec0938",
             "subject": "Read receipt for: World domination",
             "textBody": "This receipt shows that the email has been
                 displayed on your recipient's computer. There is no
                 guaranty it has been read or understood.",
             "reportingUA": "joes-pc.cs.example.com; Foomail 97.1",
             "disposition": {
               "actionMode": "manual-action",
               "sendingMode": "mdn-sent-manually",
               "type": "displayed"
             },
             "finalRecipient": "rfc822; [email protected]",
             "originalMessageId": "<[email protected]>"
           }
         }
       }, "0" ]]
{code}

Regarding MDN/send:

{code:java}
[[ "MDN/send", {
  "accountId": "ue150411c",
  "identityId": "I64588216",
  "send": {
    "k1546": {
      "forEmailId": "Md45b47b4877521042cec0938",
      "subject": "Read receipt for: World domination",
      "textBody": "This receipt shows that the email has been displayed on your 
recipient's computer. ",
      "reportingUA": "joes-pc.cs.example.com; Foomail 97.1",
      "disposition": {
        "actionMode": "manual-action",
        "sendingMode": "mdn-sent-manually",
        "type": "displayed"
      },
      "extension": {
        "X-EXTENSION-EXAMPLE": "example.com"
      }
    }
  },
  "onSuccessUpdateEmail": {
    "#k1546": {
      "keywords/$mdnsent": true
    }
  }
}, "0" ]]
{code}

Would return:

{code:java}
[[ "MDN/send", {
  "accountId": "ue150411c",
  "sent": {
    "k1546": {
      "finalRecipient": "rfc822; [email protected]",
      "originalMessageId": "<[email protected]>"
    }
  }
}, "0" ],
[ "Email/set", {
  "accountId": "ue150411c",
  "oldState": "23",
  "newState": "42",
  "updated": {
    "Md45b47b4877521042cec0938": {}
  }
}, "0" ]]
{code}

h2. Link to the specifications:

JMAP core: https://jmap.io/spec-core.html 

JMAP MDN spec: https://datatracker.ietf.org/doc/draft-ietf-jmap-mdn/



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to