News for hackers. Stuff that matters.
Re:JSX Mail: Ending All Your Problems When Creating Email Te... by halostatue on Wednesday October 05, 2022 @08:39PM (#33102991)
Just use MJML (https://github.com/mjmlio/mjml) or mrml (https://github.com/jdrouet/mrml). It solves the real problems with building emails without introducing useless abstractions like JSX.
Re:JSX Mail: Ending All Your Problems When Creating Email Te... by effisfor on Thursday October 06, 2022 @07:08AM (#33106789)
I'm currently integrating MJML into a React/JSX context. From my vantage point, MJML is the abstraction.

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.

Re:JSX Mail: Ending All Your Problems When Creating Email Te... by derrikcurran on Wednesday October 05, 2022 @09:00PM (#33103105)
MJML is terrific (haven't tried MRML) but why do you consider JSX to be a useless abstraction but not MJML?
Re:JSX Mail: Ending All Your Problems When Creating Email Te... by BiteCode_dev on Thursday October 06, 2022 @02:49AM (#33105218)
Because you get 2 levels of indirection instead of 1.

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.

Re:JSX Mail: Ending All Your Problems When Creating Email Te... by lucideer on Thursday October 06, 2022 @04:33AM (#33105947)
I'm not sure what you mean by indirection in this instance. How does JSX use 2 levels?

> 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?

Re:JSX Mail: Ending All Your Problems When Creating Email Te... by lries on Wednesday October 05, 2022 @10:02PM (#33103458)
Agreed that MJML is great, but I wouldn't call JSX a useless abstraction. Using JSX as a templating language for MJML has real benefits, like being able to use javascript directly in templates instead of having to remember handlebars/mustache/nunjucks/etc templating syntax.

And libraries like mjml-react make it really easy.

https://github.com/wix-incubator/mjml-react/

Re:JSX Mail: Ending All Your Problems When Creating Email Te... by evv on Thursday October 06, 2022 @03:31AM (#33105505)
MJML-React is awesome to use because of the JSX support: 1. you can integrate real JS without using some templatey thing, and 2. type safety with TS, helpful for auto-completion and robustness

Anyways it seems that Wix is no longer maintaining the project and Faire has taken it on: https://github.com/Faire/mjml-react

Re:JSX Mail: Ending All Your Problems When Creating Email Te... by rockwotj on Wednesday October 05, 2022 @10:57PM (#33103821)
Came here to saw we use mjnl react and it's awesome to be able to wrap mjml in your own components.
Re:JSX Mail: Ending All Your Problems When Creating Email Te... by funstuff007 on Saturday October 08, 2022 @07:32PM (#33137040)
Agreed. We use Python + Jinja to create dynamic mjml.
Re:JSX Mail: Ending All Your Problems When Creating Email Te... by Theryston on Monday October 10, 2022 @07:04AM (#33149939)
if you read a bit of the jsx mail documentation you will see that it not only allows you to use jsx in emails, it does that and gives you a complete development environment with even an email client simulator for you to be your email in time real
Re:JSX Mail: Ending All Your Problems When Creating Email Te... by santialbo on Thursday October 06, 2022 @04:40AM (#33105981)
I'm using mjml-react which gives me:

- 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?

Re:JSX Mail: Ending All Your Problems When Creating Email Te... by hombre_fatal on Thursday October 06, 2022 @09:31AM (#33107938)
HNers need to learn to just ask people why they use a given tech instead of dismissing it outright because the HNer likes to do things a different way.

The discourse would be much less boring.

Re:JSX Mail: Ending All Your Problems When Creating Email Te... by Theryston on Monday October 10, 2022 @07:06AM (#33149953)
I don't call it useless, I know the power he has, so I think he must have more competitors and we're here for that.
Re:JSX Mail: Ending All Your Problems When Creating Email Te... by munbun on Thursday October 06, 2022 @09:48AM (#33108114)
Early versions of MJML used JSX class components.
Re:JSX Mail: Ending All Your Problems When Creating Email Te... by Theryston on Monday October 10, 2022 @06:59AM (#33149917)
jsx mail not only solves the compatibility issue like others do, it also has things like a mail client emulator. especially if you want to use it without being linked to a programming language, you can just use the CLI that will give you pure HTML and CSS, among that several features that were designed to improve and facilitate the creation of email templates