Sunday, July 23, 2023
HomeEmail MarketingImportant Recommendation on The way to Use MJML

Important Recommendation on The way to Use MJML


Notes from the Dev logo red


Writing code takes time. That features coding responsive HTML emails. A superb developer writes clear, concise code that will get the job accomplished. Some would possibly even name it elegant. 

What if there was a sooner solution to write quite a bit much less code and make campaigns responsive on each e mail consumer and gadget? That’s the promise of MJML, a markup language that was created to make the job sooner and simpler. On this episode of Notes from the Dev: Video Version, Nicole Hickman joined me to stroll us by means of a number of the fundamentals of MJML (Mailjet Markup Language)

I encountered MJML once I first began creating emails. I do know a variety of e mail geeks who swear by it. However I’ve by no means had the possibility to dive into it myself. So, I used to be tremendous excited for Nicole to inform me how she makes use of it and why it’s her most well-liked solution to code an e mail. 

Take a look at our second episode of Notes from the Dev: Video Version beneath and subscribe to E mail on Acid’s YouTube channel so that you’ll make sure to see future installments. 

(Go to our Useful resource Heart to view the total transcription of this episode) 

What’s MJML? 

MJML is among the many hottest e mail frameworks on the market. A crew of builders from Mailjet created this markup language again in 2016 together with the assistance of others within the open-source neighborhood.  

Earlier than it was launched to the general public, Mailjet used it for a yr as an inside engine to generate responsive e mail designs within the drag-and-drop e mail builder, Passport. And at this time, Mailjet by Sinch prospects are utilizing MJML to design their very own responsive e mail templates

MJML is constructed on ReactJS and makes use of semantic syntax to assist e mail builders code responsive designs extra effectively. MJML’s open-source engine interprets (or parses) the markup language into HTML. It’s somewhat like magic in case you ask me. 

The result’s that e mail builders are capable of create emails sooner with fewer traces of code. 

You’d assume that responsive design could be an absolute necessity for many e mail entrepreneurs by now. However a 2020 examine from the CRM SuperOffice discovered that 1 out of 5 emails it examined weren’t optimized for cellular units. I wager you’ve encountered a number of of these in your personal inbox. 

Nobody desires to be on the e-mail crew sending out campaigns that look horrible on cellular. And who wouldn’t wish to develop emails in a sooner, easier method? So, let’s dive into Nicole Hickman’s recommendations on the best way to begin utilizing MJML. 

The fundamentals of utilizing MJML 

Nicole is at present working for Fishawack Well being in San Diego as a Direct Advertising Developer. Apart from being an skilled e mail developer, she’s additionally labored as a print manufacturing artist. Nicole had quite a bit to say about utilizing MJML, so we’re releasing her episode in two components. 

(Look ahead to half two on superior MJML strategies coming quickly.) 

Nicole acquired began by displaying us her MJML e mail boilerplate. If you wish to make certainly one of your personal, you could find some easy MJML code snippets and fundamental recommendation in our E mail Coding 101 tutorial. 

Nicole defined that the <mjml> tag acts just like the DOCTYPE. That’s the place she defines the language of the e-mail utilizing the lang attribute, which tells display screen readers the best way to correctly pronounce phrases within the language recognized within the code. That’s an essential factor to incorporate whenever you’re coding accessible emails

The <mj-head> tag consists of all the data you’d put within the head part of an HTML e mail. Nicole gave us a fast have a look at how the MJML will get parsed into HTML. At this level within the interview, Nicole’s cat acquired very excited. Possibly that was as a result of cats love the truth that MJML routinely targets Outlook to handle the e-mail consumer’s DPI scaling issues for you. That’s a significant timesaver. 

MJML sections, columns, and elements 

There are a number of fundamental sorts of “constructing blocks that you just’ll use to code an e mail with MJML.  

The physique of an e mail will get damaged down into sections <mj-section>, which might comprise a number of columns <mj-column>, which you’ll be able to then fill with quite a lot of completely different elements. Nicole mentioned she makes use of <mj-text> essentially the most typically as that’s what’s clearly used to show e mail copy. 

There are many different helpful elements that come normal with MJML. That features tags for photographs <mj-image>, buttons <mj-button>, and tables <mj-table>. As you possibly can see, MJML is a really easy and intuitive markup language. There are additionally MJML elements for social media sharing, navigation bars, hero photographs, and far more. Plus, you may also construct your personal MJML elements.  

Simply keep in mind that each part of your e mail might want to begin with <mj-section>  and <mj-column> tags that get closed out ultimately. Right here’s an instance of how that appears: 

<mj-section> 

   <mj-column> 

      <mj-text> 

         Howdy World 

      </mj-text> 

  </mj-column> 

</mj-section> 

So, in case you want a two or three-column e mail structure, you’d simply add one other <mj-column> and embrace the elements and content material you need in that column. The columns will routinely stack on cellular. 

It’s also possible to fashion the e-mail elements by defining CSS with <mj-attributes> within the e mail’s head part utilizing the <mj-class> and <mj-style> tags. Right here’s an instance of how that may look: 

<mj-head> 

    <mj-attributes> 

      <mj-class title="mjclass" colour="inexperienced" font-size="30px" /> 

    </mj-attributes> 

    <mj-style inline="inline"> 

      .blue-text div { 

      colour: blue !essential; 

      } 

    </mj-style> 

    <mj-style> 

      .red-text div { 

      colour: purple !essential; 

      text-decoration: underline !essential; 

      } 

    </mj-style> 

  </mj-head> 

  <mj-body> 

    <mj-section> 

      <mj-column> 

        <mj-text css-class="red-text">I am purple and underlined</mj-text> 

        <mj-text css-class="blue-text">I am blue due to inline</mj-text> 

        <mj-text mj-class="mjclass">I am inexperienced</mj-text> 

      </mj-column> 

    </mj-section> 

  </mj-body> 

Wish to mess around with MJML code? There’s a “strive it stay” function on their web site. 

Extra on getting began with MJML 

After all, that is solely the start of the numerous methods you need to use MJML to code responsive HTML emails. I’m certain at this level you’ve acquired a number of questions. That’s why we’re engaged on the second half of this dialogue with Nicole. 

Partially two, I’ll ask Nicole a number of the questions I hear builders asking about MJML: 

  • How does MJML work with darkish mode emails? 
  • How do you handle to code overlapping parts? 
  • How do you arrange picture swapping for cellular? 

You don’t wish to miss that video, So, make sure that to subscribe to E mail on Acid on YouTube

Within the meantime, listed here are a number of different locations to go and study MJML: 

Use Mailjet’s MJML tutorials: 

A giant thanks to Nicole Hickman for sharing her experience on MJML with us. If you wish to join with Nicole, you could find her on Twitter and Linkedin

And at last, regardless of the way you select to develop emails… don’t neglect to check! Use E mail on Acid by Sinch to take a look at and preview how your code renders on all main shoppers and dozens of units. Repair points earlier than you hit ship and ship e mail perfection. 

Writer: Megan Boshuyzen

Megan is a graphic designer turned e mail developer who’s labored on all features of e mail advertising. She believes good emails for good causes make a constructive distinction on this planet. Megan is at present working as an e mail developer for Sinch E mail. Go to her web site and study extra at megbosh.com.

Writer: Megan Boshuyzen

Megan is a graphic designer turned e mail developer who’s labored on all features of e mail advertising. She believes good emails for good causes make a constructive distinction on this planet. Megan is at present working as an e mail developer for Sinch E mail. Go to her web site and study extra at megbosh.com.



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments