You can’t do IMAP in the browser, can you?

David DOLCIMASCOLO
Nov 25, 2016 · 3 min read
OpenPaas unified inbox

  • The backend translates the command to an IMAP request (for instance “SELECT INBOX”) or a SMTP request and sends it to the actual IMAP backend.
  • The backend receives the IMAP or SMTP response, analyses and parses it and sends back the data to the frontend (for instance a list of email messages)

  • Find another solution that allows us to develop the webmail application entirely in Angular.js and make it run completely in the browser, with no backend at all. →Technically interesting, yet difficult to implement for a very simple reason: you can’t open TCP sockets from the browser so you can’t do IMAP and you can’t do SMTP. All you can do is send HTTP requests.
  • It moves the application logic to the user’s browser (on a mobile phone, tablet or a desktop computer) and allows us to gain natural scalability by utilizing the growing power of devices.
  • It simplifies the code required to “make it work” by not having to convert from frontend calls to IMAP commands back and forth.
  • It’s pretty cool !

  • It works over HTTP(s) which is good for us (you remember we’re inside a browser, right?) and uses JSON as the exchange format, which is rock-solid and native in the browser.
  • It uses the same set of APIs for the equivalent of IMAP and SMTP, simplifying even more the implementation by eliminating the need to understand the specifics of multiple protocols. It even support Calendars and Contacts synchronization, though we don’t use that.
  • It supports batching of operations, which means less round-trips to the email server, which means less network and battery usage (which means happy customers, by the way !)

Linagora Engineering

We are Open Source Engineers, Hacking Awesome Stuff

Thanks to Stéphane Colson and Luc Duzan.

David DOLCIMASCOLO

Written by

5-legged sheep

Linagora Engineering

We are Open Source Engineers, Hacking Awesome Stuff