Guides
Send First Email
Send an email using curl, Python, or Node.js.
Prerequisites
- An eSMS Mail account at send.esmsafrica.io
- An API key (Settings → API Keys)
- A verified domain (or use the default sender)
Using curl
curl -X POST https://send.esmsafrica.io/v1/emails/ \
-H "Authorization: Bearer esms_k_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"from": {"email": "hello@yourdomain.com", "name": "My App"},
"to": [{"email": "recipient@example.com"}],
"subject": "Hello from eSMS Mail!",
"html": "<h1>It works!</h1><p>This email was sent via the eSMS Mail API.</p>",
"text": "It works! This email was sent via the eSMS Mail API."
}'Using Python
import requests
response = requests.post(
"https://send.esmsafrica.io/v1/emails/",
headers={
"Authorization": "Bearer esms_k_your_api_key",
"Content-Type": "application/json",
},
json={
"from": {"email": "hello@yourdomain.com", "name": "My App"},
"to": [{"email": "recipient@example.com"}],
"subject": "Hello from eSMS Mail!",
"html": "<h1>It works!</h1><p>Sent with Python.</p>",
},
)
print(response.json())Using Node.js
const response = await fetch('https://send.esmsafrica.io/v1/emails/', {
method: 'POST',
headers: {
'Authorization': 'Bearer esms_k_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
from: { email: 'hello@yourdomain.com', name: 'My App' },
to: [{ email: 'recipient@example.com' }],
subject: 'Hello from eSMS Mail!',
html: '<h1>It works!</h1><p>Sent with Node.js.</p>',
}),
});
const data = await response.json();
console.log(data);What happens next
- The API returns a response with the email
idandstatus: "queued" - The email is sent within seconds
- You can check the status in the Email Logs dashboard
- Set up webhooks to receive delivery notifications