---
title: "Trimite un e-mail | Tajo"
description: "Trimite e-mailuri tranzacționale prin API-ul Brevo"
url: https://tajo.io/ro/docs/email-messaging/transactional-email/send-email/
markdown: https://tajo.io/ro/docs/email-messaging/transactional-email/send-email.md
lang: ro-RO
author: "Set Noa"
author_url: https://tajo.io/ro/set-noa/
robots: noindex
---

Solicită acces anticipat

Introduceți prenumele și adresa de e-mail profesională. Vă vom trimite un link pentru a confirma cererea de acces la Tajo.

# Trimite un e-mail

[Set Noa](https://tajo.io/ro/set-noa/)

Trimite e-mailuri tranzacționale individuale folosind endpointul `/v3/smtp/email`.

## Endpoint

```http
POST /v3/smtp/email
```

## Corpul cererii

### E-mail simplu

```json
{
  "sender": {
    "name": "Your App",
    "email": "noreply@yourapp.com"
  },
  "to": [
    {
      "email": "user@example.com",
      "name": "John Doe"
    }
  ],
  "subject": "Welcome to our service!",
  "htmlContent": "<html><body><h1>Welcome!</h1><p>Thank you for signing up.</p></body></html>"
}
```

### E-mail avansat

```json
{
  "sender": {
    "name": "Your App",
    "email": "noreply@yourapp.com"
  },
  "to": [
    {
      "email": "user@example.com",
      "name": "John Doe"
    }
  ],
  "cc": [
    {
      "email": "cc@example.com",
      "name": "CC User"
    }
  ],
  "bcc": [
    {
      "email": "bcc@example.com"
    }
  ],
  "subject": "Order Confirmation #{{order_id}}",
  "htmlContent": "<html><body><h1>Order Confirmed</h1><p>Your order {{order_id}} has been confirmed.</p></body></html>",
  "textContent": "Your order {{order_id}} has been confirmed.",
  "params": {
    "order_id": "12345"
  },
  "tags": ["transactional", "order-confirmation"],
  "headers": {
    "X-Custom-Header": "custom-value"
  }
}
```

## Exemple de cod

### JavaScript/Node.js

```javascript
const brevo = require('@getbrevo/brevo');

const apiInstance = new brevo.TransactionalEmailsApi();
apiInstance.setApiKey(brevo.TransactionalEmailsApiApiKeys.apiKey, process.env.BREVO_API_KEY);

const sendEmail = async () => {
  const sendSmtpEmail = new brevo.SendSmtpEmail();

  sendSmtpEmail.subject = "Welcome to our service!";
  sendSmtpEmail.htmlContent = "<html><body><h1>Welcome!</h1></body></html>";
  sendSmtpEmail.sender = { name: "Your App", email: "noreply@yourapp.com" };
  sendSmtpEmail.to = [{ email: "user@example.com", name: "John Doe" }];

  try {
    const result = await apiInstance.sendTransacEmail(sendSmtpEmail);
    console.log('Email sent:', result);
    return result;
  } catch (error) {
    console.error('Error sending email:', error);
    throw error;
  }
};
```

### Python

```python
import sib_api_v3_sdk
from sib_api_v3_sdk.rest import ApiException

configuration = sib_api_v3_sdk.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'

api_instance = sib_api_v3_sdk.TransactionalEmailsApi(sib_api_v3_sdk.ApiClient(configuration))

send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(
    to=[{"email": "user@example.com", "name": "John Doe"}],
    sender={"name": "Your App", "email": "noreply@yourapp.com"},
    subject="Welcome to our service!",
    html_content="<html><body><h1>Welcome!</h1></body></html>"
)

try:
    api_response = api_instance.send_transac_email(send_smtp_email)
    print(api_response)
except ApiException as e:
    print("Exception when calling TransactionalEmailsApi->send_transac_email: %s\n" % e)
```

### cURL

```bash
curl -X POST "https://api.brevo.com/v3/smtp/email" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "api-key: YOUR_API_KEY" \
  -d '{
    "sender": {
      "name": "Your App",
      "email": "noreply@yourapp.com"
    },
    "to": [
      {
        "email": "user@example.com",
        "name": "John Doe"
      }
    ],
    "subject": "Welcome to our service!",
    "htmlContent": "<html><body><h1>Welcome!</h1></body></html>"
  }'
```

## Răspuns

### Răspuns de succes (201 Created)

```json
{
  "messageId": "<202301151234.12345@smtp-relay.mailin.fr>"
}
```

### Răspunsuri de eroare

**Cheie API invalidă (401)**

```json
{
  "code": "unauthorized",
  "message": "Invalid API key provided"
}
```

**Format de e-mail invalid (400)**

```json
{
  "code": "invalid_parameter",
  "message": "Invalid email format in 'to' field"
}
```

**Limită de rată depășită (429)**

```json
{
  "code": "too_many_requests",
  "message": "Rate limit exceeded"
}
```

## Parametri

### Parametri obligatorii

| Parametru | Tip | Descriere |
| --- | --- | --- |
| `sender` | object | Informații despre expeditor |
| `to` | array | Lista obiectelor destinatar |
| `subject` | string | Subiectul e-mailului |

### Parametri opționali

| Parametru | Tip | Descriere |
| --- | --- | --- |
| `htmlContent` | string | Conținutul HTML al e-mailului |
| `textContent` | string | Conținutul text al e-mailului |
| `cc` | array | Destinatari în copie |
| `bcc` | array | Destinatari în copie ascunsă |
| `replyTo` | object | Adresa de răspuns |
| `attachments` | array | Fișiere atașate |
| `params` | object | Parametrii șablonului |
| `tags` | array | Etichete de e-mail pentru urmărire |
| `headers` | object | Anteturi personalizate |

## Variabile de șablon

Folosește variabile de șablon în subiect și în conținut:

```json
{
  "subject": "Welcome {{firstName}}!",
  "htmlContent": "<h1>Hello {{firstName}} {{lastName}}</h1>",
  "params": {
    "firstName": "John",
    "lastName": "Doe"
  }
}
```

## Atașamente

Include fișiere atașate:

```json
{
  "attachments": [
    {
      "content": "base64_encoded_content",
      "name": "invoice.pdf"
    },
    {
      "url": "https://example.com/document.pdf",
      "name": "document.pdf"
    }
  ]
}
```

## Bune practici

1. **Include mereu atât conținut HTML, cât și text** pentru o livrabilitate mai bună
2. **Folosește variabile de șablon** în loc să concatenezi conținutul
3. **Completează corect datele expeditorului** ca să eviți filtrele antispam
4. **Adaugă etichete** pentru urmărire și analize
5. **Validează adresele de e-mail** înainte de trimitere
6. **Tratează erorile elegant**, cu logică de reîncercare

## Limite de rată

- **Limita de rată API**: pe nivelul general, pe care îl primește orice plan, acest endpoint permite 1.000 de cereri pe secundă și 3.600.000 pe oră. Nivelul avansat (Professional și Enterprise) permite 2.000 pe secundă, iar nivelul extins (Enterprise) 6.000.
- **Volumul de trimitere**: câte e-mailuri poți trimite este stabilit de planul tău Brevo, separat de limita de rată.

Vezi [Limite de rată](https://tajo.io/ro/docs/rate-limits/) și [pagina Brevo despre limitele de rată](https://developers.brevo.com/docs/api-limits).

## Urmărire

E-mailurile trimise prin acest endpoint sunt urmărite automat pentru:

- Starea livrării
- Rata de deschidere
- Urmărirea clicurilor
- Gestionarea respingerilor

Vezi analize detaliate în panoul tău de administrare Brevo, la **Statistics** → **Transactional**.

## Endpointuri conexe

- Șabloane de e-mail
- Atașamente
- [Statistici e-mail](https://tajo.io/ro/docs/analytics-reporting/)
