Skip to main content
ScrubiMail

Sending setup

Before you can send, prove you own the domain you are sending from. It is a one-time job: add the domain, publish three DNS records, and verify. Most of the time goes into waiting for DNS.

Related:Email sendingTransactional email

Checked against the API source on

Before you start

  • An API key. For this page it needs the domains scope, and later send to send. Create one on the API keys page.
  • Sending credits. Each email costs 1 sending credit, separate from validation credits. Top up in billing.
  • Access to your domain's DNS settings at your DNS provider (Cloudflare, Route 53, GoDaddy, Namecheap and so on).

1. Add your domain

Add the domain that appears after the @ in your From address. A subdomain such as mail.yourcompany.com is a good idea: it keeps app and marketing mail away from the reputation of your main domain. Each domain is separate, so a verified yourcompany.com does not cover mail.yourcompany.com.

Add a sending domain

POST/send/domains/
Scope: domains

Registers a domain you want to send from and generates its DKIM key straight away, so the response already contains the key to publish. If the sending service is briefly unreachable the domain is still created and the key is generated on the next verify.

Body

Add a sending domain: Body
NameTypeRequiredDescription
domainstringYesThe domain, for example yourcompany.com or mail.yourcompany.com. Stored lower-case.

Request

curl -X POST "https://api.scrubimail.com/scrubimail/api/v1/send/domains/" \
  -H "X-API-Key: $SCRUBIMAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "yourcompany.com"
}'

Response

201 Created
{
  "id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
  "domain": "yourcompany.com",
  "verified": false,
  "spf_verified": false,
  "dkim_verified": false,
  "dmarc_verified": false,
  "verification_details": {},
  "dkim_selector": "scrubimail",
  "dkim_public_key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu3...",
  "status": "pending",
  "created_at": "2026-11-16T07:00:00Z",
  "updated_at": "2026-11-16T07:00:00Z"
}

Errors

Add a sending domain: errors
StatusCodeWhen
400validation_errorA field is missing or invalid. error.details lists each one.
400-{"error": "Domain already exists"}: you already added it.
401authentication_requiredNo API key was sent. The response carries a WWW-Authenticate header.
401invalid_credentialsThe key is unknown, inactive, expired, or the request IP is not on the key's allow-list. The response carries a WWW-Authenticate header.
403permission_deniedThe key has scopes set and domains is not one of them.

Keep the id (you pass it as sending_domain_id on every send) and the dkim_public_key from the response. You can fetch both again any time with GET /send/domains/.

2. Publish the DNS records

Add these three TXT records at your DNS provider. Replace yourcompany.com with the domain you added.

DNS records for a sending domain
PurposeTypeHostValueRequired
SPFTXT@ (the domain itself)v=spf1 include:_spf.scrubimail.com ~allYes
DKIMTXTscrubimail._domainkeyv=DKIM1; k=rsa; p=<dkim_public_key>Yes
DMARCTXT_dmarcv=DMARC1; p=none; rua=mailto:[email protected]For bulk sends
  • SPF tells receivers that ScrubiMail's servers may send for your domain. It passes when your record includes _spf.scrubimail.com, directly or through another include.
  • DKIM lets receivers verify the signature we add to every message. The selector is scrubimail, so the record lives at scrubimail._domainkey.yourcompany.com. Paste the dkim_public_key from the domain after p=. It is unique to your domain, so copy it exactly and do not let your DNS provider wrap or truncate it.
  • DMARC tells receivers what to do when SPF and DKIM fail. Start with p=none to monitor, then tighten to quarantine once reports show your mail passing. Gmail and Yahoo expect it from bulk senders, and ScrubiMail requires it for bulk and campaign sends.

3. Verify the domain

When the records are live, ask ScrubiMail to check them. Run it again whenever you change a record. The domain is verified when SPF and DKIM both pass; that is what lets you send single emails and SMTP mail. DMARC is checked and reported but only blocks bulk sends and campaigns.

Verify a sending domain

POST/send/domains/{id}/verify/
Scope: domains

Looks up your DNS and updates the domain. verified becomes true when SPF and DKIM both pass; DMARC is reported separately and is only required for bulk sends. verification_details tells you, per record, whether it passed and what to fix.

Path

Verify a sending domain: Path
NameTypeRequiredDescription
idUUIDYesThe domain's id.

Request

curl -X POST "https://api.scrubimail.com/scrubimail/api/v1/send/domains/a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d/verify/" \
  -H "X-API-Key: $SCRUBIMAIL_API_KEY"

Response

200 OK
{
  "id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
  "domain": "yourcompany.com",
  "verified": true,
  "spf_verified": true,
  "dkim_verified": true,
  "dmarc_verified": false,
  "verification_details": {
    "spf": {
      "ok": true,
      "reason": ""
    },
    "dkim": {
      "ok": true,
      "reason": ""
    },
    "dmarc": {
      "ok": false,
      "reason": "No DMARC record found at _dmarc.yourcompany.com. Publish a TXT record such as: v=DMARC1; p=none; rua=mailto:you@yourdomain"
    },
    "checked_at": "2026-11-16T07:20:00Z"
  },
  "dkim_selector": "scrubimail",
  "dkim_public_key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu3...",
  "status": "active",
  "created_at": "2026-11-16T07:00:00Z",
  "updated_at": "2026-11-16T07:00:00Z"
}

Errors

Verify a sending domain: errors
StatusCodeWhen
404not_foundNo domain with that id on your account.
503-code: "dkim_unavailable": the DKIM key could not be generated because the sending service is unreachable. The DNS checks still ran. Try again in a few minutes.
401authentication_requiredNo API key was sent. The response carries a WWW-Authenticate header.
401invalid_credentialsThe key is unknown, inactive, expired, or the request IP is not on the key's allow-list. The response carries a WWW-Authenticate header.
403permission_deniedThe key has scopes set and domains is not one of them.
What each check looks for
CheckPasses whenCommon reason it fails
SPFYour domain has exactly one SPF record and it authorises ScrubiMail by including _spf.scrubimail.com.No SPF record yet, two SPF records, or an include that is negated or past the 10-lookup limit.
DKIMThe p= value published at scrubimail._domainkey matches the key ScrubiMail signs with.The record is missing, was truncated when pasted, or holds an older or empty key.
DMARCExactly one record starting with v=DMARC1 is published at _dmarc.No record, or more than one.

Each check stores a plain-language reason in verification_details when it fails, so the response itself tells you what to fix. The status field is active once the domain is verified and pending until then. You can confirm a record yourself with dig TXT scrubimail._domainkey.yourcompany.com or nslookup -type=TXT yourcompany.com.

From address rules

Where the sender address is checked
ChannelRule
HTTP API, single sendThe domain in sending_domain_id must be yours and verified. from_email must be on that domain: a From address on a different domain is rejected with 400. The message is signed with that domain's DKIM key.
HTTP API, bulk and campaignsThe same, including the 400 for a From address that is not on the sending domain, and the domain must also have a DMARC record.
SMTP relayEnforced on every message. The From domain must be a verified domain on your account. If your app sets an envelope sender (MAIL FROM), its domain must be one of your verified domains too. Otherwise the message is refused with 550 5.7.1.

You cannot send through a domain you have not verified. Recipients on your suppression list are skipped, and unsubscribes and hard bounces are added to it automatically. See the Sending API.

4. Send your first email

With a verified domain you can send. Use the Sending API from your code, or point an app at the SMTP relay. For a smooth start, send to a few of your own addresses first and look at the message source in your inbox: you want to see spf=pass, dkim=pass and dmarc=pass. A new domain should ramp volume up gradually, to engaged recipients first, and you should validate your lists with the Validation API before a campaign so hard bounces do not hurt your reputation.

Something missing or wrong? Email [email protected].