JunkMail

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

FieldTypeRequiredDescription
fromAddressIdstringYesUUID of the sending temporary address
tostringYesRecipient email address
subjectstringYesEmail subject (max 200 characters)
bodystringYesEmail body in plain text (max 50,000 characters)
bodyHtmlstringNoEmail 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 id can be used to retrieve the sent email via GET /api/v1/emails/:id once it has been processed.