Email domains
You send from your own domain. OnCharge gives you a few DNS records to add; once they resolve, mail is signed as your domain, bounces come back through your domain, and tracked links stay on your domain. Every record points at an OnCharge name under m.oncharge.io, so OnCharge can rotate signing keys and move sending infrastructure without you touching DNS again.
Add a domain#
curl -X POST https://app.oncharge.io/api/v1/email-domains \
-H "Authorization: Bearer $ONCHARGE_MESSAGING_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "example.com", "click_tracking": true }'| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The domain you send from, for example example.com or mail.example.com. |
custom_return_path | string | No | The subdomain bounces return to. Default send, so send.example.com. |
open_tracking | boolean | No | Count opens with a tracking image. Default false. |
click_tracking | boolean | No | Count clicks by routing links through your tracking subdomain. Default false. |
tls | string | No | opportunistic (default) uses TLS whenever the receiving server offers it; enforced sends only over TLS and fails the email otherwise. |
{
"id": "d1c3a5e7-2b4f-4a6c-8e0d-1f3b5a7c9e21",
"name": "example.com",
"status": "pending",
"custom_return_path": "send",
"open_tracking": false,
"click_tracking": true,
"tls": "opportunistic",
"records": [
{ "record": "DKIM", "type": "CNAME", "name": "oc1._domainkey.example.com", "value": "<your key host>.m.oncharge.io", "ttl": 3600, "status": "pending" },
{ "record": "RETURN_PATH", "type": "CNAME", "name": "send.example.com", "value": "rp.m.oncharge.io", "ttl": 3600, "status": "pending" },
{ "record": "TRACKING", "type": "CNAME", "name": "links.example.com", "value": "t.m.oncharge.io", "ttl": 3600, "status": "pending" },
{ "record": "DMARC", "type": "TXT", "name": "_dmarc.example.com", "value": "v=DMARC1; p=none;", "ttl": 3600, "status": "pending" }
]
}Copy the records exactly as the API or the dashboard shows them: the DKIM value is unique to your account, and the names depend on your domain and settings.
The records#
| Record | Type | Name (for example.com) | Points at | What it does |
|---|---|---|---|---|
DKIM | CNAME | <selector>._domainkey.example.com | A key host under m.oncharge.io, unique to your account | Signs every email as example.com, so it passes DKIM and DMARC alignment. OnCharge rotates the key behind the name; you never change the record. |
RETURN_PATH | CNAME | send.example.com (your custom_return_path) | rp.m.oncharge.io | Bounces return to your own subdomain, so SPF passes and aligns with your domain. |
TRACKING | CNAME | Your tracking subdomain, such as links.example.com | t.m.oncharge.io | Keeps tracked links and unsubscribe links on your domain. Only listed when open or click tracking is on, and served over HTTPS. |
INBOUND | MX | Your inbound subdomain, such as inbound.example.com | inbound.m.oncharge.io | Receives mail sent to that subdomain. Only listed when you turn on inbound email. |
DMARC | TXT | _dmarc.example.com | v=DMARC1; p=none; ... | Only listed when your domain has no DMARC record. If you already have one, keep it: OnCharge never asks you to change your policy. |
Each record object has record, type, name, value, ttl, status and, for MX, priority.
Some DNS hosts add your domain to the end of every name you type. If yours does, enter send rather than send.example.com. CNAME records at DNS hosts that proxy traffic must be set to DNS only.
Verify#
Once the records are in your DNS, ask OnCharge to check them:
curl -X POST https://app.oncharge.io/api/v1/email-domains/{id}/verify \
-H "Authorization: Bearer $ONCHARGE_MESSAGING_KEY"DNS changes usually show within minutes but can take up to a day or two, so verify again if a record is still pending. When a domain's status changes, OnCharge sends a domain.updated webhook, and domain.verified or domain.failed (see Email webhooks).
| Status | Meaning |
|---|---|
not_started | Added, but no check has run yet. |
pending | Checking; one or more records are not found yet. |
verified | Every required record is in place. You can send. |
partially_verified | The required records are in place but an optional one (tracking or inbound) is not. You can send; that feature stays off. |
failed | The records were not found in time, or one has the wrong value. Fix them and verify again. |
temporary_failure | A record that used to resolve could not be checked or no longer resolves, for example after a DNS change. Check your DNS and verify again. |
Manage domains#
| Endpoint | Does |
|---|---|
GET /email-domains | Lists your domains. |
GET /email-domains/{id} | Reads one, with its records and their statuses. |
PATCH /email-domains/{id} | Changes open_tracking, click_tracking or tls. |
POST /email-domains/{id}/verify | Checks the records now. |
DELETE /email-domains/{id} | Removes the domain. Emails from it are refused afterwards. |
Good practice#
- Use your own domain for marketing mail. Free mail addresses can't be used as the sender: their providers publish strict DMARC policies, and mail claiming to come from them is rejected.
- Consider a subdomain such as
mail.example.comfor marketing, so its reputation is kept apart from your everyday mail. - Keep the records in place. Removing a CNAME stops signing or bounce handling for every email from that domain.
- Move DMARC forward when you are ready.
p=nonemeets the bulk-sender rules of the large mailbox providers. Once all your mail passes, a stricter policy protects your domain from spoofing.