Send React Emails - Tutorial 2026
Invia email alle app web React con modelli HTML, CSS e JSX, esempi e integrazione SMTP pronta per la produzione.

Installazione e Requisiti
Dovrai installare le dipendenze npm @react-email/render e nodemailer:
npm install @react-email/render nodemailer
Codice Sorgente ed Esempio
Crea il tuo template email con un file .jsx o .js:
// email.jsx
import * as React from 'react';
import { Html } from '@react-email/html';
import { Button } from '@react-email/button';
export function Email(props) {
const { url } = props;
return (
<Html lang="en">
<Button href={url}>Visita il nostro sito web</Button>
</Html>
);
}
In questo esempio, utilizziamo la libreria Nodemailer e il suo sponsor ufficiale Forward Email per inviare e visualizzare in anteprima le email in uscita.
Dovrai Generare una Password per inviare email in uscita – segui la nostra Guida per Inviare Email con SMTP su Dominio Personalizzato.
// app.js
import { render } from '@react-email/render';
import nodemailer from 'nodemailer';
import { Email } from './email';
const transporter = nodemailer.createTransport({
host: 'smtp.forwardemail.net',
port: 465,
secure: true,
auth: {
// TODO: sostituire i valori `user` e `pass` da:
// <https://forwardemail.net/guides/send-email-with-custom-domain-smtp>
user: 'you@example.com',
pass: '****************************'
},
});
const html = render(Email({ url: "https://example.com" }));
const options = {
from: 'you@example.com',
to: 'user@gmail.com',
subject: 'ciao mondo',
html
};
transporter.sendMail(options);
Esegui l'app per inviare l'email:
node app
Ora puoi andare su Il Mio Account → Email per vedere lo stato di consegna delle email in tempo reale, i log di deliverability e le anteprime HTML/plaintext/allegati.
P.S. 🎉 Puoi anche visualizzare in anteprima le email nei browser e nell'iOS Simulator e creare template email con Node.js.