📜 ⬆️ ⬇️

JMAP - open protocol will replace IMAP when exchanging emails

Earlier this month , the JMAP protocol, developed under the guidance of the IETF , was actively discussed at Hacker News. We decided to talk about why it is needed and how it works.


/ Pxhere / pd

Than did not please IMAP


The IMAP protocol was introduced in 1986. Many things described in the standard are no longer relevant today. For example, the protocol can return the number of lines of letters and MD5 checksums — this functionality is practically not used in modern mail clients.
')
Another problem is traffic consumption. In the case of IMAP, emails are stored on the server and are periodically synchronized with local clients. If for some reason the copy on the user's device is “spoiled”, it is necessary to re-synchronize all mail. In today's world, when thousands of mobile devices can be connected to a server, this approach leads to an increased consumption of traffic and computing resources.

Difficulties arise not only with the protocol itself, but also with the mail clients that work with it. Since its inception, IMAP has been subjected to various revisions many times - the current version is currently IMAP4. At the same time, there are many optional extensions for it — ninety RFCs with additions have been published on the network. One of the most recent is RFC8514 , introduced in 2019.

However, many companies offer their own proprietary solutions that should simplify working with IMAP or replace it altogether: Gmail , Outlook , Nylas . The result is that existing mail clients support only some of all the available functions. Such diversity leads to market segmentation.

“Moreover, a modern email client should not just forward messages, but be able to work with contacts and synchronize with the calendar,” says Sergey Belkin, head of the development department at IaaS provider 1cloud.ru . - Today, for these purposes use third-party protocols like LDAP , CardDAV and CalDAV . This approach complicates the configuration of firewalls in corporate networks and opens up new vectors for cyber attacks. ”

JMAP is intended to solve the indicated problems. It is developed by experts from FastMail under the guidance of the Internet Engineering Council (IETF). The protocol works over HTTPS, uses JSON (for this reason it is suitable not only for exchanging electronic messages, but also for solving a number of tasks in the cloud) and simplifies the organization of work with mail in mobile systems. In addition to processing letters, JMAP also provides the ability to connect extensions to work with contacts and the calendar scheduler.

Features of the new protocol


JMAP is a stateless protocol and does not require a permanent connection to the mail server. This feature simplifies work in unstable mobile networks and allows you to save battery power devices.

The email in JMAP is in JSON structure format. It contains all the information from the RFC5322 (Internet Message Format) message that mail applications might need. According to the developers, this approach should simplify the creation of clients, since the server will be responsible for solving potential difficulties (associated with MIME , reading headers and coding).

The client uses the API to access the server. To do this, it generates an authenticated POST request, the properties of which are described in the session JMAP object. The request has the format application / json and consists of a single JSON request object. The server also generates a single response object.

In the specification (clause 3), the authors give the following example with a query:

{ "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 the 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 complete JMAP specification with examples of implementation can be found on the official project website . There, the authors posted a description of the specifications for JMAP Contacts and JMAP Calendars - they are directed to work with calendars and contact lists. According to the authors, Contacts and Calendars were separated into separate documents so that they could be refined and standardized independently of the “core”. The source code for JMAP is in the repository on GitHub .


/ Pxhere / pd

Perspectives


Despite the fact that the work on the standard has not yet been completed, it is already being implemented in production environments. For example, the creators of the open mail server Cyrus IMAP implemented its JMAP version. FastMail developers have released a server framework for Perl, and the JMAP authors have introduced a proxy server .

It can be expected that in the future projects based on JMAP will become more and more. For example, there is some possibility that the developers of Open-Xchange, creating an IMAP server for Linux-based systems, will switch to the new protocol. Members of the community , who have formed around the company's tools, are asking for IMAP to abandon them.

IETF and FastMail developers are saying that more and more users see the need for a new open standard for messaging. JMAP authors hope that in the future more companies will begin to implement this protocol.

Our additional resources and sources:

How to check cookies for compliance with GDPR - a new open tool will help

How to save using the application programming interface
DevOps in the cloud service on the example of 1cloud.ru
Evolution of cloud architecture 1cloud

Potential HTTPS attacks and how to protect against them.
How to protect a server on the Internet: 1cloud.ru experience
Short educational program: what is Continuous Integration

Source: https://habr.com/ru/post/452958/


All Articles