Send Emails
Send emails from your temporary addresses
Send an Email
Sends an email from one of your temporary addresses. The email is queued for asynchronous delivery.
POST /api/v1/emails
Required scope: emails:write
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
fromAddressId | string | Yes | UUID of the sending temporary address |
to | string | Yes | Recipient email address |
subject | string | Yes | Email subject (max 200 characters) |
body | string | Yes | Email body in plain text (max 50,000 characters) |
bodyHtml | string | No | Email body in HTML |
Example
curl -X POST https://api.junkmail.dev/api/v1/emails \
-H "Authorization: Bearer jm_live_xxxx" \
-H "Content-Type: application/json" \
-d '{
"fromAddressId": "550e8400-e29b-41d4-a716-446655440000",
"to": "destinataire@example.com",
"subject": "Test depuis JunkMail",
"body": "Ceci est un email envoyé via l'\''API JunkMail.",
"bodyHtml": "<p>Ceci est un email envoyé via l'\''API <b>JunkMail</b>.</p>"
}'
JavaScript
const response = await fetch('https://api.junkmail.dev/api/v1/emails', {
method: 'POST',
headers: {
'Authorization': 'Bearer jm_live_xxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
fromAddressId: '550e8400-e29b-41d4-a716-446655440000',
to: 'destinataire@example.com',
subject: 'Test depuis JunkMail',
body: "Ceci est un email envoyé via l'API JunkMail.",
}),
});
Python
import requests
response = requests.post(
'https://api.junkmail.dev/api/v1/emails',
headers={
'Authorization': 'Bearer jm_live_xxxx',
'Content-Type': 'application/json',
},
json={
'fromAddressId': '550e8400-e29b-41d4-a716-446655440000',
'to': 'destinataire@example.com',
'subject': 'Test depuis JunkMail',
'body': "Ceci est un email envoyé via l'API JunkMail.",
}
)
Response
{
"data": {
"id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
},
"message": "Email queued for sending"
}
The email is processed asynchronously. The returned
idcan be used to retrieve the sent email viaGET /api/v1/emails/:idonce it has been processed.