Testing & compliance

Sandbox

Test the full integration without sending real mail: generate SMTP credentials that capture every message, inspect them, and reset when done.

The sandbox gives you disposable SMTP credentials. Anything you send through them is captured and stored on your account — perfect for testing your pipeline end-to-end before touching real mail.

Create credentials

bash
curl -X POST https://api.mailafrica.online/api/sandbox/credentials \
  -H "X-API-Key: MAIL_<your_api_key_here>" \
  -H "Content-Type: application/json" \
  -d '{"scopes": ["smtp"]}'

Returns a client_id and client_secret pair. Use them to AUTH PLAIN against the sandbox SMTP server.

Sandbox SMTP settings

bash
curl https://api.mailafrica.online/api/sandbox/credentials/smtp \
  -H "X-API-Key: MAIL_<your_api_key_here>"

The response gives the host, port, and username. The password is only echoed when newly generated — otherwise regenerate:

bash
curl -X POST https://api.mailafrica.online/api/sandbox/credentials/smtp/regenerate \
  -H "X-API-Key: MAIL_<your_api_key_here>"
Regenerating invalidates the old password immediately. Sandbox capture is capped at 2,000 messages per month.

Read captured messages

bash
# List captured sandbox messages
curl "https://api.mailafrica.online/api/sandbox/messages?page=1&per_page=20" \
  -H "X-API-Key: MAIL_<your_api_key_here>"

# One message
curl https://api.mailafrica.online/api/sandbox/messages/77 \
  -H "X-API-Key: MAIL_<your_api_key_here>"

# Clear all sandbox messages
curl -X DELETE https://api.mailafrica.online/api/sandbox/messages \
  -H "X-API-Key: MAIL_<your_api_key_here>"

Captured messages include from/to, subject, text/html bodies, headers, and attachments — the same shape you'll see for real inbound messages.