Skip to content
OnCharge.io
View as Markdown
Developer docs

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#

Shell
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 }'
FieldTypeRequiredDescription
namestringYesThe domain you send from, for example example.com or mail.example.com.
custom_return_pathstringNoThe subdomain bounces return to. Default send, so send.example.com.
open_trackingbooleanNoCount opens with a tracking image. Default false.
click_trackingbooleanNoCount clicks by routing links through your tracking subdomain. Default false.
tlsstringNoopportunistic (default) uses TLS whenever the receiving server offers it; enforced sends only over TLS and fails the email otherwise.
Response 200
{
  "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#

RecordTypeName (for example.com)Points atWhat it does
DKIMCNAME<selector>._domainkey.example.comA key host under m.oncharge.io, unique to your accountSigns 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_PATHCNAMEsend.example.com (your custom_return_path)rp.m.oncharge.ioBounces return to your own subdomain, so SPF passes and aligns with your domain.
TRACKINGCNAMEYour tracking subdomain, such as links.example.comt.m.oncharge.ioKeeps tracked links and unsubscribe links on your domain. Only listed when open or click tracking is on, and served over HTTPS.
INBOUNDMXYour inbound subdomain, such as inbound.example.cominbound.m.oncharge.ioReceives mail sent to that subdomain. Only listed when you turn on inbound email.
DMARCTXT_dmarc.example.comv=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:

Shell
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).

StatusMeaning
not_startedAdded, but no check has run yet.
pendingChecking; one or more records are not found yet.
verifiedEvery required record is in place. You can send.
partially_verifiedThe required records are in place but an optional one (tracking or inbound) is not. You can send; that feature stays off.
failedThe records were not found in time, or one has the wrong value. Fix them and verify again.
temporary_failureA 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#

EndpointDoes
GET /email-domainsLists 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}/verifyChecks 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.com for 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=none meets the bulk-sender rules of the large mailbox providers. Once all your mail passes, a stricter policy protects your domain from spoofing.