JSX Mail: Ending All Your Problems When Creating Email Templates
jsx-mail.org
jsx-mail.org
If 1 does the job equally well, you should choose 1.
In fact, MJML can be used with any templating solution, so if your system already uses JSX, JSX doesn't add indirection, and you should use it.
But if your system is not, adding JSX on top has just prevents you from hacking a shell scripts that generates the email in a few lines, generating the email from whatever backend you use, or just writing the template in a free form file without anything to install.
You gain complexity, you loose flexibility.
> MJML can be used with any templating solution
Wouldn't that add complexity where JSX has less? Why use 2 systems (MJML + [templating]) when you can get away with 1 (JSX)?
> adding JSX on top has just prevents you from hacking a shell scripts
As far as I understand both are npm libraries so I can't see how one allows this where the other doesn't? Surely their application is the same usage pattern?
And libraries like mjml-react make it really easy.
Anyways it seems that Wix is no longer maintaining the project and Faire has taken it on: https://github.com/Faire/mjml-react
- proper i18n with any react i18n library
- js to create complicated emails
- nicer component reuse story.
- syntax highlighting and completion when used with Typescript
- can be integrated with other nice js tools like Storybook for seeing all emails in one place and play with their props.
How is that useless?
The discourse would be much less boring.
I once worked with a guy who kept looking over my shoulder and saying 'just use binary'. Nice guy, but they had to let him go.
This project is cool, but doesn't solve the fundamental issue that CSS support in email clients is just very poor.
That's precisely the thing it's trying to solve.
I didn't see any mention into how the tool's able to translate modern CSS into email-client-supported CSS; might be worth calling that out as the main value prop, as that's the real thing that I care about when building emails.
The first one, definitely! The first one shows the structure of the document and places the button in context. I cant actually tell that the second example is equivalent, since there's no "rest of the document" or if there is it's done by magic behind the scenes.
Edit: I don't want to come off as too harsh on this project, this example is relatively simple so it probably doesn't show off the power of programming your email templates as code.
I can see that a few other people already brought up MJML so I hope I can have some value added but basically MJML is fanatical about making sure all their changes are supported on a very wide range of email clients. They have hundreds of contributors and 10k+ starts on Github all fixing bugs and compatibility. The project has 2000+ commits. Any new framework that comes out is going to have a lot of catching up to do.
When I use MJML I feel very confident my email will work on many different email clients. And even be responsive.
[1] https://mjml.io/
Another tip, I highly recommend a CSS minifier which inlines styles to fix a variety of CSS priority issues.
Anyone reading this, feel free to hit me up if you want help onboarding.
Even Gmail/Outlook/Yahoo users may disable js and/or HTML when reading mail.
// js-side
import { render } = from 'jsx-mail';
const template = await render('Welcome', { name: 'John' });
console.log(template) // <html>...<h1>John Welcome to jsx-mail</h1>...</html>
(https://github.com/Theryston/jsx-mail)Generating a plaintext message dynamically isn’t much of a pain point but html emails can be.
To me, the first one, but I’m not convinced JSX is a good idea anywhere and I’ve been writing HTML for 30 years.
Not sure if the framework is as advanced. But, seems to solve a lot of basic issues. Surprising that providers like sparkpost or ses are not able to solve generation at scale problem with templates.
Lot's of cool follow-on value-adds you can do once your emails are in JS like this. Like writing test cases to validate that none of your emails are susceptible to HTML injection. Or writing tests about never exceeding Gmail's 100kb limit. Or rendering your emails in Storybook.
But our Emails had to replicate other teams designs 1:1 pixel perfect. So we mostly used the same code blocks.
I needed some sort of framework that would organize those code blocks and jsx was perfect. I generated twig templates out of the JSX and used php to send the emails.
E-mail clients by and large show html properly too.
A few rules:
1. Inline css of course
2. Use pixels as units
3. Don’t get too fancy.
I tuned out as soon as I read the word. “React”.
greater compatibility email clients (because it blocks you from using css not allowed) offers components to facilitate and give compatibility to email clients, has an email client simulator, allows using jsx, allows using styled-components, is being applied to turn css not allowed by email clients you make into css allowed (automatically by the compiler) how can this be useless?
The problem with library is that they don’t go well across language, you need to call an api. (I use Java)
As of today, most email client understand the basic css.
It's decent.