At the beginning of the month on Hacker News the JMAP protocol, We decided to discuss why it was needed and how it works.
/ / PD
What doesn't IMAP provide?
Protocol was introduced in 1986. Many aspects described in the standard are no longer relevant today. For example, the protocol can return the number of lines in an email and checksums, but this functionality is hardly used in modern email clients.
Another issue relates to traffic consumption. With IMAP, emails are stored on the server and periodically synchronized with local clients. If, for some reason, the local copy on the user's device becomes corrupted, the entire email has to be synchronized again. In today's world, where thousands of mobile devices can connect to the server, this approach leads to increased traffic and computational resource usage.
Challenges arise not only with the protocol itself but also with the email clients that work with it. Since IMAP's creation, it has undergone numerous revisions — the current version today is IMAP4. Additionally, there are many optional extensions for it — on the web, there are ninety RFCs with enhancements. One of the most recent is introduced in 2019.
At the same time, many companies offer their proprietary solutions that aim to simplify working with IMAP or even replace it entirely: , , As a result, it turns out that existing email clients only support some of the available features. This variety leads to market segmentation.
Moreover, a modern email client should not only forward messages but also be able to work with contacts and synchronize with a calendar, says Sergey Belkin, head of development at the IaaS provider. Today, third-party protocols like , and are used for these purposes. This approach complicates firewall configuration in corporate networks and opens new vectors for cyberattacks.
JMAP is designed to address the identified issues. It is being developed by specialists from FastMail under the guidance of the Internet Engineering Task Force (IETF). The protocol operates over HTTPS, utilizes JSON (which is why it is suitable not only for email exchange but also for addressing a range of tasks in the cloud), and simplifies email management in mobile systems. In addition to processing emails, JMAP also provides the ability to connect extensions for managing contacts and a calendar-planner.
Features of the New Protocol
JMAP is and does not require a constant connection to the mail server. This feature simplifies operation in unstable mobile networks and helps save battery life on devices.
An email in JMAP is presented in a JSON structure. It contains all the information from the message (Internet Message Format), which may be needed by mail applications. According to the developers, this approach should simplify client creation, as the server will handle potential complexities (related to , reading headers, and encoding).
To interact with the server, the client uses an API. It does this by forming an authenticated POST request, the properties of which are described in the JMAP session object. The request is in application/json format and consists of a single JSON request object. The server also generates a single response object.
In (in section 3) the authors provide the following example with a request:
{
"using": [ "urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail" ],
"methodCalls": [
[ "method1", {
"arg1": "arg1data",
"arg2": "arg2data"
}, "c1" ],
[ "method2", {
"arg1": "arg1data"
}, "c2" ],
[ "method3", {}, "c3" ]
]
}
Below is an example of a response that the server will generate:
{
"methodResponses": [
[ "method1", {
"arg1": 3,
"arg2": "foo"
}, "c1" ],
[ "method2", {
"isBlah": true
}, "c2" ],
[ "anotherResponseFromMethod2", {
"data": 10,
"yetmoredata": "Hello"
}, "c2"],
[ "error", {
"type":"unknownMethod"
}, "c3" ]
],
"sessionState": "75128aab4b1b"
}
The full specification of JMAP with implementation examples can be found on the project page. There, the authors have also provided a description of the specifications for and — which are focused on working with calendars and contact lists. According to the authors, Contacts and Calendars have been separated into distinct documents so they can be developed and standardized independently of the 'core'. The source codes for JMAP are available at .

/ / PD
Prospects
Although the official work on the standard is not yet complete, it is already being implemented in production environments. For example, the creators of the open mail server have implemented its JMAP version. Developers from FastMail created a server framework for the new protocol in Perl, while the authors of JMAP presented .
It is expected that in the future, more projects based on JMAP will emerge. For instance, there is some likelihood that developers from Open-Xchange, who are creating an IMAP server for Linux systems, will transition to the new protocol. Participants from the community strongly , which has formed around the company's tools.
Developers from IETF and FastMail state that more and more users see the need for a new open standard for messaging. The authors of JMAP hope that in the future, more companies will start adopting this protocol.
Our additional resources and sources:
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Source: habr.com
