Invia email dell'app tramite l'SMTP di Brevo
Punta la tua app o il tuo client email a smtp-relay.brevo.com per inviare email transazionali come conferme d'ordine e reset della password, con una chiave SMTP, non una chiave API.

Come funziona
const nodemailer = require("nodemailer");
async function main() {
// create reusable transporter object using the default SMTP transport
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
},
});
// send mail with defined transport object
let info = await transporter.sendMail({
from: '"Sender Name" <[email protected]>', // sender address
to: "[email protected]", // list of receivers
subject: "Hello ✔", // Subject line
text: "Hello {{ contact.FIRSTNAME }} , This is an SMTP message with customizations", // plain text body
});
console.log("Message sent: %s", info.messageId);
// Message sent: <[email protected]>
}
main().catch(console.error);
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!",
"htmlContent":"<html><head></head><body><p>Hello,</p>This is my first transactional email sent from Brevo.</p></body></html>"
}'
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);
from brevo import Brevo
from brevo.transactional_emails import (
SendTransacEmailRequestSender,
SendTransacEmailRequestToItem,
)
client = Brevo(api_key="your-api-key")
result = client.transactional_emails.send_transac_email(
subject="Hello from Brevo!",
html_content="<html><body><p>Hello,</p><p>This is my first transactional email.</p></body></html>",
sender=SendTransacEmailRequestSender(
name="Alex from Brevo",
email="[email protected]",
),
to=[
SendTransacEmailRequestToItem(
email="[email protected]",
name="John Doe",
)
],
)
print("Email sent. Message ID:", result.message_id)
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Brevo\Brevo;
use Brevo\TransactionalEmails\Requests\SendTransacEmailRequest;
use Brevo\TransactionalEmails\Types\SendTransacEmailRequestSender;
use Brevo\TransactionalEmails\Types\SendTransacEmailRequestToItem;
$client = new Brevo(apiKey: 'your-api-key');
$result = $client->transactionalEmails->sendTransacEmail(
new SendTransacEmailRequest([
'subject' => 'Hello from Brevo!',
'htmlContent' => '<html><body><p>Hello,</p><p>This is my first transactional email.</p></body></html>',
'sender' => new SendTransacEmailRequestSender([
'name' => 'Alex from Brevo',
'email' => '[email protected]',
]),
'to' => [
new SendTransacEmailRequestToItem([
'email' => '[email protected]',
'name' => 'John Doe',
]),
],
])
);
echo 'Email sent. Message ID: ' . $result->messageId . PHP_EOL;
Send a transactional email from my verified sender to me@example.com with the subject "Your order is confirmed", then show me the message ID and its status in the logs.
Il primo pannello usa nodemailer via SMTP. I pannelli delle API inviano lo stesso tipo di messaggio con POST /v3/smtp/email, con gli SDK Node.js, Python e PHP o con un prompt MCP.
Relay SMTP: i fatti
Relay SMTP. L'host è smtp-relay.brevo.com. Usa le porte 587 o 2525, oppure la porta 465 con crittografia SSL o TLS. Per le connessioni al relay SMTP usa una chiave SMTP, non una chiave API.
Piano Free. Il piano Free include 300 invii email al giorno e fino a 100.000 contatti archiviati. Tutti i piani Brevo ti danno accesso alle API RESTful, a SMTP e ai webhook in uscita per le email transazionali.
Batch. Il relay SMTP non supporta l'invio in batch; usa gli endpoint API di invio in batch.
Hosting in UE. I server di hosting su cui Brevo elabora e archivia i propri database si trovano tutti nell'Unione Europea. Brevo utilizza OVH in Francia e Germania e i dati sono archiviati su Google Cloud in Belgio.