Outbound email

Sending Domains

Add and verify your own domain for outbound email. MailAfrica provisions a dedicated sending agent, gives you DKIM/CNAME records, and lets you create from-addresses.

Send from your own domain with full DKIM signing. When you add a domain, MailAfrica provisions a dedicated sending agent and returns the DNS records you publish — once they verify, sends through that domain use your own dedicated SMTP path.

You can add up to 5 sending domains. Sending from a custom domain costs 10 TZS per recipient (vs 5 TZS from the platform sender).

Add a sending domain

bash
curl -X POST https://api.mailafrica.online/api/domains/ \
  -H "X-API-Key: MAIL_<your_api_key_here>" \
  -H "Content-Type: application/json" \
  -d '{"domain": "yourcompany.co.tz", "from_local_part": "noreply"}'

from_local_part (default noreply) is the default from-address for the domain. The response includes the DNS records to publish:

json
{
  "success": true,
  "data": {
    "domain": {
      "id": 2,
      "domain": "yourcompany.co.tz",
      "purpose": "sending",
      "status": "pending",
      "from_local_part": "noreply",
      "created_at": "2026-08-15T00:00:00Z"
    },
    "dns_records": [
      { "type": "TXT", "host": "<dkim-host>", "value": "<public-key>" },
      { "type": "CNAME", "host": "<cname-host>", "value": "<cname-target>" }
    ]
  }
}

Verify the domain

bash
curl -X POST https://api.mailafrica.online/api/domains/2/verify \
  -H "X-API-Key: MAIL_<your_api_key_here>"

Publish the TXT (DKIM) and CNAME records, then re-check. Status transitions pending → verified (or failed if records are wrong). verified_at is set once confirmed.

Create sender addresses

Each verified sending domain gets its default local part (e.g. noreply@yourcompany.co.tz) automatically. Add up to 100 additional from-addresses per account:

bash
curl -X POST https://api.mailafrica.online/api/domains/2/senders \
  -H "X-API-Key: MAIL_<your_api_key_here>" \
  -H "Content-Type: application/json" \
  -d '{"local_part": "billing"}'

You can then send as billing@yourcompany.co.tz by passing from_domain_id and from_address on the outbound call. Any other from-address is rejected with 400 — only the domain default and recorded senders are allowed.

List & delete

bash
# List sending domains
curl https://api.mailafrica.online/api/domains/ \
  -H "X-API-Key: MAIL_<your_api_key_here>"

# List all sender addresses
curl https://api.mailafrica.online/api/domains/senders \
  -H "X-API-Key: MAIL_<your_api_key_here>"

# Delete a sender address
curl -X DELETE https://api.mailafrica.online/api/domains/senders/99 \
  -H "X-API-Key: MAIL_<your_api_key_here>"

# Delete a sending domain
curl -X DELETE https://api.mailafrica.online/api/domains/2 \
  -H "X-API-Key: MAIL_<your_api_key_here>"
Only send from domains and addresses you have verified. Providers (and recipients) treat unauthenticated From addresses as spam, and DKIM is enforced under your own domain.