Tuesday, November 14, 2023
HomeEmail MarketingImportant Recommendation on Tips on how to Use MJML

Important Recommendation on Tips on how to Use MJML


Notes from the Dev logo red

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

What if there was a sooner strategy to write so much much less code and make campaigns responsive on each e-mail shopper 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 among the fundamentals of MJML (Mailjet Markup Language)

I encountered MJML after 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 strategy to code an e-mail. 

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

(Go to our Useful resource Middle to view the complete transcription of this episode) 

What’s MJML? 

MJML is among the many hottest e-mail frameworks on the market. A workforce 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 12 months as an inside engine to generate responsive e-mail designs within the drag-and-drop e-mail builder, Passport. And in the present day, Sinch Mailjet 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 just a little like magic if you happen to ask me. 

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

You’d suppose that responsive design can be an absolute necessity for many e-mail entrepreneurs by now. However a 2020 research from the CRM SuperOffice discovered that 1 out of 5 emails it examined weren’t optimized for cellular gadgets. I wager you’ve encountered just a few of these in your personal inbox. 

Nobody needs to be on the e-mail workforce sending out campaigns that look horrible on cellular. And who wouldn’t need to develop emails in a sooner, less complicated manner? So, let’s dive into Nicole Hickman’s tips about the best way to begin utilizing MJML. 

The fundamentals of utilizing MJML 

Nicole is presently working for Fishawack Well being in San Diego as a Direct Advertising Developer. In addition to being an skilled e-mail developer, she’s additionally labored as a print manufacturing artist. Nicole had so much 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 obtained began by displaying us her MJML e-mail boilerplate. If you wish to make one in every of your personal, you will discover some easy MJML code snippets and fundamental recommendation in our Electronic 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 vital factor to incorporate if you’re coding accessible emails

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

MJML sections, columns, and parts 

There are just a few fundamental varieties 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 may comprise a number of columns <mj-column>, which you’ll then fill with quite a lot of totally different parts. 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 parts that come normal with MJML. That features tags for photos <mj-image>, buttons <mj-button>, and tables <mj-table>. As you may see, MJML is a really easy and intuitive markup language. There are additionally MJML parts for social media sharing, navigation bars, hero photos, and rather more. Plus, you may also construct your personal MJML parts.  

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 in the long run. Right here’s an instance of how that appears: 

<mj-section> 

   <mj-column> 

      <mj-text> 

         Hiya World 

      </mj-text> 

  </mj-column> 

</mj-section> 

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

You can even model the e-mail parts 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 !vital; 

      } 

    </mj-style> 

    <mj-style> 

      .red-text div { 

      colour: crimson !vital; 

      text-decoration: underline !vital; 

      } 

    </mj-style> 

  </mj-head> 

  <mj-body> 

    <mj-section> 

      <mj-column> 

        <mj-text css-class="red-text">I am crimson 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 “attempt it dwell” characteristic on their web site. 

Extra on getting began with MJML 

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

Partly two, I’ll ask Nicole among 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 need to miss that video, So, be sure that to subscribe to Electronic mail on Acid on YouTube

Within the meantime, listed below are just a few 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 will discover her on Twitter and Linkedin

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



Creator: Megan Boshuyzen

Megan is a graphic designer turned e-mail developer who’s labored on all elements of e-mail advertising and marketing. She believes good emails for good causes make a constructive distinction on this planet. Megan is presently working as an e-mail developer for Sinch Electronic mail. Go to her web site and be taught extra at megbosh.com.

Creator: Megan Boshuyzen

Megan is a graphic designer turned e-mail developer who’s labored on all elements of e-mail advertising and marketing. She believes good emails for good causes make a constructive distinction on this planet. Megan is presently working as an e-mail developer for Sinch Electronic mail. Go to her web site and be taught extra at megbosh.com.



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments