The Complete Magazine on Open Source

MJML: An open source framework that makes responsive email easy

1.38K 0

emailing information

Developing an email app has never been easy. In fact, there have been quite a large number of hurdles in integrating the responsive email with the existing code of the website. But to make things easier, open source markup language called MJML has finally emerged as a great solution. It works seamlessly with all major email clients and offers an ultimate flexibility to integrate an email client with a website. It won’t be an overstatement if we say that MJML redefines the email coding for us in more ways than one. With the praises ushered for this new framework, what does it amounts to for developers and end users? Well, we are here to answer this question in detail. So here is how MJML makes responsive email easy and value added.

Deliverability as a fruit

More than anything else what MJML offers is an awesome deliverability of emails at fastest possible speed. Deliverability issues directly impact the ROI of a company and hit credibility over a period. In that respect, the open source framework just works superbly. It ensures lightning first delivery of emails.

As per an estimation by MJML more than 20 billion emails have been sent so far by businesses of all niches so far. MJML, over a span of just two years since its inception in 2015, quickly rose to global prominence as the most user-friendly framework for responsive email. It mainly brought the virtue of lightning-fast delivery. Easy and stripped-off code structure and simple elements make MJML the right framework when it comes to speed of delivery.

Mobile friendly emails as never before

Consider all the email clients presently in the market, and you will realise that in spite of their tall claims as being responsive and mobile-friendly, they often fail to fit the mobile screens perfectly. As more than 50 percent of emails are now opened and read on mobile devices, being responsive is a must-have requirement now for emails. To address this issue of mobile friendliness, the developers of MJML recently brought Passport, which is nothing but a responsive email builder that works with drag and drop actions.

While Passport allows the user to create a responsive email through drag and drop functions, in the background these actions are translated into HTML code template. When the user creates the email, the engine understands in JSON and then translates it into HTML code by the engine.

Once this responsiveness achieved by the Passport, users can directly interact with the engine and so the JSON language was replaced by the new markup language. The new language is a lot similar to the HTML but is semantic in character and more responsive.

Problem with majority of email clients

To understand the real benefit of email coding, you need to have a clear idea of the shortcomings of many email clients that users depend upon for years. Most email clients including the big names such Outlook and Apple Mail render the same HTML differently. In fact, there is no accepted standard for rendering HTML. This is why without in-line styles the look and feel of your email can be heavily compromised at times. For example, often you can see the media queries of your HTML file just go missing completely when it is rendered for the mobile screen.

To address this problem, several new approaches sprung up like HTML approach, mobile first approach and fab four technique. But all these techniques being deployed by email developers across different platforms does not solve the core problem which is just an absence of a standard to address the problem for all email clients at the same time.

How it brings standard responsive coding for all email clients

MJML handles the complexities of building responsive email to fit different screen sizes irrespective of the difference among email clients by abstracting all the low-level interactions and animations with a very easy syntax. The best part is all the challenging components for befitting emails in different screen sizes are easily made available by the open source development as it is inherently a responsive language. MJML also allows incorporating high level and complex components such as carousel to make it easy for the users to make use interactive elements such as image gallery, graphics and interaction animation within the very email.

Understanding its working process

Now it is time to understand how the language works. MJML is built on React, which is a widely known JavaScript library. React was developed by Facebook and became one of their most advanced offering for the programmers of the web. React’s powerful components which are already known for their versatility, and the semantic code has made MJML a reality.

MJML converts the code into responsive HTML with the use of two approaches, respectively as mobile-first and hybrid coding. The first approach ensures creating the mobile-friendly version as the preliminary and default, while the second approach allows the dynamic capability to take the screen size as per the device in use.

Let us see how these two approaches work in real world scenarios. For Outlook email client, the mobile version of the email will be the one across both mobile and desktop screens. But despite the unified model, the mobile Outlook version shown on desktop offers much better readability of the email compared to the earlier desktop version.

The hybrid approach, on the other hand, ensuring adapting to the device screen size as and when possible by the use of various style elements, media queries, nested tables, etc. This approach is also highly effective to create mobile friendly email view. For example, if an email is displayed on the desktop with multiple columns, on mobile screen it can be displayed with just single column layout.

When the majority of emails are read and opened on mobile, responsiveness is a crucial consideration, and you need a single solution. In that respect, MJML just comes as a robust solution for various email clients.