Envía email desde Node.js
Instala @getbrevo/brevo, crea un BrevoClient con tu clave API y llama a sendTransacEmail, o apunta Nodemailer al relay SMTP de Brevo.

Cómo funciona
npm install @getbrevo/brevo
import { BrevoClient } from '@getbrevo/brevo';
const brevo = new BrevoClient({ apiKey: 'your-api-key' });
const result = await brevo.transactionalEmails.sendTransacEmail({
subject: 'Hello from Brevo!',
htmlContent: '<html><body><p>Hello,</p><p>This is my first transactional email.</p></body></html>',
sender: { name: 'Alex from Brevo', email: '[email protected]' },
to: [{ email: '[email protected]', name: 'John Doe' }],
});
console.log('Email sent. Message ID:', result.messageId);
npm install nodemailer
const nodemailer = require("nodemailer");
let transporter = nodemailer.createTransport({
host: "smtp-relay.brevo.com",
port: 587,
secure: false, // true for 465, false for other ports
auth: {
user: "[email protected]", // generated brevo user
pass: "xxxxxxxxx", // generated brevo password
},
});
curl --request POST \
--url https://api.brevo.com/v3/smtp/email \
--header 'accept: application/json' \
--header 'api-key:YOUR_API_KEY' \
--header 'content-type: application/json' \
--data '{
"sender":{
"name":"Alex from Brevo",
"email":"[email protected]"
},
"to":[
{
"email":"[email protected]",
"name":"John Doe"
}
],
"subject":"Hello from Brevo!",
"textContent":"Hello. This is my first transactional email sent from Brevo."
}'
Pregunta a tu agente de IA
Dale este prompt a un agente de IA conectado al servidor MCP de Brevo.
Before I send email from my Node.js app, check that I have a verified sender and an authenticated sending domain. List what is missing.
Por qué funciona
Node.js con Brevo: lo esencial
API. Envía un email transaccional con POST https://api.brevo.com/v3/smtp/email y tu clave API en la cabecera api-key.
Relay SMTP. El host es smtp-relay.brevo.com. Usa los puertos 587 o 2525, o el 465 con cifrado SSL o TLS. Usa una clave SMTP, no una clave de API, para las conexiones al relay SMTP.
Plan gratuito. El plan gratuito incluye 300 envíos de email al día y hasta 100.000 contactos almacenados. Todos los planes de Brevo dan acceso a las API RESTful, SMTP y los webhooks salientes para email transaccional.
Alojamiento en la UE. Los servidores de alojamiento en los que Brevo procesa y almacena sus bases de datos están todos en la Unión Europea. Brevo utiliza OVH en Francia y Alemania, y los datos se almacenan en Google Cloud en Bélgica.