How to export emails from Figma to MJML code using Emailify
Follow along with this step by step Figma tutorial video.
Steps
- Open a Figma file, search for Emailify in the Resources icon, and run or save the Emailify plugin.
- Create a new email container by naming it and clicking Add New Emailify Container.
- Build the email using Emailify components, rows, columns, and layers that map to MJML structure, then preview desktop and mobile in the plugin.
- Click Export HTML, change the export type to MJML source code under Download To Your Computer, and choose the template to export.
- Enable Upload image URLs, optionally turn off HTML minification for readability, and click Export to MJML.
- Download the .zip file, then open the MJML file and inspect the generated MJML, index.html, and images folder.
- Paste the MJML into the MJML Try it live editor to confirm it compiles to HTML correctly.

Published
Used in this video
Emailify
ć”ć¼ć«
Stop hand-coding HTML emails.
Design responsive emails in Figma and export production-ready HTML for popular email platforms.
135k+ installs
Video Transcript
Today, Iām going to be showing you a quick tutorial on how to export your email designs from Figma to MJML code automatically using the Emailify Figma plugin.
To get started, all we need to do is go to our Figma file, click on the resources icon at the top here, and search for Emailify. Under the āPluginsā tab, if you click on the Emailify result, you can run the Figma plugin by either clicking on this āRunā button here, or you can click on this little āSaveā icon here to add it to your saved Figma plugins list. Iāve already clicked on that icon, so Iām just going to go to my canvas, right-click anywhere, go down to āPlugins,ā go down to āSaved plugins,ā and then click on Emailify. Thatās just going to run the Figma plugin we saved a second ago.
If youāre brand new to the Figma plugin, the way that it works is it helps you to design emails in Figma, which you can then automatically export to code or various email marketing platforms automatically using the built-in Figma plugin export features. For today, Iām just going to be creating a really simple example, so Iām just going to call this example āTemplate Testā and click on āAdd New Emailify Container.ā Thatās going to add a special frame to our Figma file that we can now add components to. Youāll notice that thereās a bunch of different starter components in the Figma plugin that you can automatically add. This just helps make it easy to create common blocks, but there are a variety of ways to create new content. You can use some of the other features down here to add rows and columns and things like that. Thereās also some templates. If you want to check out some of the pre-built templates, just click on the new button again, go to āBrowse Figma Email Templates,ā and you can see thereās a whole bunch here that you can duplicate for free from the Figma community. For example, this Airbnb templateāwe can open that up here and see what that looks like. Iāll just bring that over to my Figma file here to show you what that looks like.
The important thing to notice, especially if youāre focusing on MJML, is that these layers map one-to-one with the MJML structure. What I mean by that is if we go to the MJML site, go to mjml.io, and then go to the documentation part of the website, and go down to some of the components, you can see that the components in MJML are one-to-one with the components in your Emailify designs. What that means is you can see here weāve got rows, weāve got columns, weāve got elements, weāve got button elements. You can see down here weāve got a button, weāve got a spacer, weāve got a divider, weāve got a text layer, and all of these are mapping up to the MJML components in here. You can see weāve got our columns, weāve got our divider, weāve got our spacer, weāve got our text layerāall of these are basically mapped to MJML. This is really important because itās going to show what thatās going to look like when it exports to code in a moment.
As I said, you can see here weāve got the same structure. Weāve got a section, which is basically a row. Weāve got a column, and then inside that column are our content layers. Same in here; weāve got our rows, weāve got our columns, and weāve got our content layers directly inside the columns. The same thing applies for multiple columns. Weāve got a row, column, column, and content inside of those columns. You can see here when I click on a column, this gives you the option to add these elements to any of those column layers. I can add these navigation links in here, and thatās going to map to these navbar links over here. Again, this is a really direct mapping to MJML, and thatās going to be important to know once we export this out.
Now that weāve got our template, you can preview it by clicking on the preview button in the Figma plugin at any time. This is going to automatically render a real preview of the code in your plugin window before we export it. You can see what it looks like on desktop, and then we can go down to mobile and check that out as well. You can also override some of the styles on mobile too. If you click on any of your layers and click on the settings button, thatās going to automatically give you a bunch of different options to apply mobile overrides. For example, text sizes, overriding image styles, padding, border radiusāall these different overrides that you can do. Iād encourage you to check those out.
Iām not going to be going into all of the details about how to design the emails in this video, but if youāre interested in that, Iād highly recommend checking out some of the other videos on the YouTube channel or going to our documentation site. If you click on the āStart Hereā button, this will let you go through all of the documentation. You can see exactly how to create all of the elements and style them, add things like links, dynamic contentāeverything youād basically want to know is all found in the documentation site. Again, Iād highly recommend checking that out and also checking out some of the other video tutorials for more of the design content.
Basically, once youāve got your design ready to go in Figma and youāre happy with how it looks in the Emailify preview, to export it to MJML, all we need to do is click on the āExport HTMLā button in the Figma plugin. Iām going to click on that now. You can see by default itās set to export an HTML email, but weāre going to change this to MJML source code. Just go ahead and click on the MJML source code under the āDownload To Your Computerā subcategory. Click on that, and you can see the little logos change to be the MJML logo. Thatās looking really good. We only want to export this one template today, so Iām just going to click on this one here.
The last thing weāre going to do is upload the image URLs as well. This means that itās going to automatically host the images, so we can just copy-paste the code, and those images are already going to be hosted for us. Iām going to check that. For this example, Iām just going to turn off the minification of the HTML just to make it a bit more readable. Normally, I would leave that on because I want the code to be as small as possible, but this is basically just going to nest the code in a nicer way, so we can read it more easily. Iām going to turn that off for now. Now, again, Iād normally leave that on, but just to show you what it looks like, Iām going to turn that off and then click on āExport to MJML.ā Iāve just clicked that button. Thatās going to now generate all of the MJML code for us. Itās going to export all the images, upload those, and then give us a zip file we can download. The codeās now ready. Iām going to click on the āDownload your .zip fileā button, save that to my computer, and if you unzip your zip file and then open up the folder, youāll see this content here.
You can see that weāve got our Emailify template, and thatās looking really good. Weāve got our MJML file, weāve got our index.html file, which is the compiled version of that MJML file, and weāve got our images folder if we need those later as well. Just to show you what this looks like, if we go to the MJML website and click on the āTry it liveā link, that will open up this editor over here. This basically lets us paste in or write MJML code, and that will automatically compile it to HTML. Thatās what MJML does: it takes this source code, transforms it, and compiles it into this production-ready HTML. Weāre going to have a look at that now for our own code.
Iām just going to paste this in here. If we go back to our folder, find your MJML file, and just drag and drop that in here, we can copy all of that MJML source code, paste it into the MJML code editor, paste that in, and you can see here on the right weāve got our email as weād expect. Thatās looking really good. You can see all the codes being rendered as HTML, and you can see on the left-hand side here all of the MJML code has been exported. Weāve got our sections, weāve got our columns, weāve got our text, and these are all correlating to what we had a look at in the documentation a moment ago. You can see here weāve got our section, column, text, and thatās exactly what we can see in our code over here. Weāve got sections, columns, and text, and all of the properties are automatically being populated from our style that we set in Figma. This is all automatic. You donāt need to code anything. Itās automatically going to generate the MJML for you, and with that one click, youāve basically got all of that code written for you. Thatās looking really good.
Again, we can check out the compiled HTML. MJML is going to compile all this for us, and again, this is basically just an example of what it looks like. You wouldnāt necessarily use this email editor in the MJML website to compile your code. There are a bunch of different ways to do that. If you go to the usage panel in the documentation site, the quickest way is to use the online editor, which we were just in a moment ago over here, but what you really want to do is check out some of these other methods. You might use the Visual Studio Code Figma plugin, one of these other text editor Figma plugins, or using a command line tool like Node.js or just a command line prompt. You can basically create a command line interface that you can run commands in to compile the code.
But again, itās really up to you. There are also some other platforms like Loops. Loops.so uses MJML natively, so if you are creating your emails on Loops, you can just upload your MJML file, and that will automatically work. There are a bunch of other platforms that use MJML too. Really, the point of MJML is itās a developer-friendly markup or syntax that can then be edited really easily, and you can then make those changes without having to tweak all of the actual compiled HTML. For example, if we go into here and we wanted to change this heading up here, where weāve got āLevel up your checkoutā, we could easily change that text. We could call this, you know, āNew heading hereā, and thatās going to automatically update the compiled HTML.
Again, if youāre using MJML, you probably know why youāre using it, so Iām not going to go through all of the ins and outs of what MJML is and how to use it. But if you are needing the MJML format for your development team or the platform youāre working with, this is a really easy way to export it from Figma if youāve designed your emails using the Emailify Figma plugin. Again, this wonāt work if youāve already pre-designed your emails before using the plugin. You will need to use the Figma pluginās design tools to help you create that layout again to match the expected MJML formatting. But once youāve done that, you can see here there are a bunch of different options. The design flexibility is really high. You can basically create whatever you want. Whatever you could design with MJML itself, you can create using Emailify, and thatās going to generate the production-ready MJML code for you to use however you like.
I hope thatās helpful. If youāre wanting to generate MJML code from Figma, this is going to be a really easy way to go about it with a one-click export. Thank you, as always, for watching, and weāll be back with more Figma tutorials like this one very soon.

Adam Brock
Founder & CEO of Hypermatic


