Send email from Node.js
Install @getbrevo/brevo, create a BrevoClient with your API key and call sendTransacEmail, or point Nodemailer at the Brevo SMTP relay.

How it works
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."
}'
Ask your AI agent
Give an AI agent connected to the Brevo MCP server this prompt.
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.
Set it up
Create your keys and verify a domain
In Settings, open SMTP & API > API keys & MCP. Give an API key Restricted access per resource. The SMTP relay needs an SMTP key, not an API key. Configure your sending domain and sender first.
Install and send
Run npm install @getbrevo/brevo, create a BrevoClient with your apiKey and call brevo.transactionalEmails.sendTransacEmail with a subject, a sender, a to list and one body type: HTML, text or a template ID. The SDK requires Node.js 18+.
Check the result
The quick start prints result.messageId after the send. Confirm delivery under Transactional, then Email logs. Set timeoutInSeconds and maxRetries in the BrevoClient constructor. timeoutInSeconds defaults to 60 and maxRetries defaults to 2.


