Courriels

Envoyer un email

Mettre en file d'attente un e-mail transactionnel pour la livraison.

POST/emails
1curl -X POST 'https://sendtern.com/emails' \
2  -H 'Authorization: Bearer st_your_api_key' \
3  -H 'Content-Type: application/json' \
4  -d '{
5  "from": "Acme <hello@mail.acme.io>",
6  "to": [
7    "ada@example.com"
8  ],
9  "subject": "Your sign-in code",
10  "html": "<p>482 913</p>",
11  "tags": [
12    {
13      "name": "category",
14      "value": "auth"
15    }
16  ]
17}'
Réponse
1{
2  "id": "47be30ca-24b7-48fb-b35d-ff287b89e66d"
3}

Accepts the email and returns HTTP 200 with its ID. Delivery happens asynchronously; follow it with Retrieve email. Send an Idempotency-Key header to retry safely.

Paramètres du corps

fromstringrequis

Adresse de l'expéditeur. Utilisez Name <address> pour un nom convivial. Le domaine doit être vérifié.

tostring | string[]requis

Adresse du destinataire, ou un tableau de jusqu'à 50.

subjectstringrequis

Objet de l'e-mail, jusqu'à 500 caractères.

htmlstring

Corps HTML. Obligatoire à moins que text ne soit défini.

textstring

Corps en texte brut. Fournissez du texte, du HTML ou un modèle publié.

ccstring | string[]

Comptez pour atteindre la limite de 50 destinataires.

bccstring | string[]

Comptez pour atteindre la limite de 50 destinataires.

reply_tostring | string[]

Où vont les réponses.

tagsobject[]

Jusqu'à dix objets contenant un nom et une valeur.

templateobject

Un ID ou alias de modèle publié et des variables facultatives.

En-têtes

Idempotency-Keystring

Jusqu’à 256 caractères. Voir Touches d’identification.