Skip to main content
ScrubiMail

Quickstart: send your first email

Sign up, create a key, verify a domain and send. Most of the five minutes is waiting for DNS to update; the API calls themselves take seconds.

Related:Email validationEmail sendingSMTP relay

Checked against the API source on

You need a domain you control and access to its DNS settings. You cannot send from a free mailbox address such as gmail.com: mail has to come from a domain you have verified. If you only want to test validation, you can stop after step 2.

  1. Sign up and create an API key

    Create an account, then open API keys and create a key. The full key is shown once, so copy it straight into your secrets manager. For a first try, leave the scopes empty (full access); narrow them later, see Authentication. New accounts include free credits; see pricing for the current allowance.

    Shell
    export SCRUBIMAIL_API_KEY="paste-your-key-here"

    Every example below reads the key from that variable and sends it in the X-API-Key header. Keep it on your server, never in browser or mobile code.

  2. Check an address before you send to it

    This is the step most email APIs do not have. POST /validate/ checks syntax, DNS and the mailbox itself. Run it on addresses you do not already trust (signup forms, imported lists) so you do not send to dead mailboxes. A deep check takes a few seconds; add ?mode=fast for a quick syntax and DNS check.

    curl -X POST "https://api.scrubimail.com/scrubimail/api/v1/validate/" \
      -H "X-API-Key: $SCRUBIMAIL_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "email": "[email protected]"
    }'

    Send to the address when is_valid is true. Read verdict and sub_status for everything else; see Validation API. Each call costs 1 validation credit.

  3. Add your sending domain

    Use the domain that appears after the @ in your From address. A subdomain such as mail.yourcompany.com is a good choice because it keeps its reputation separate from your main domain. Keep the id from the response: you pass it as sending_domain_id when you send.

    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"
    }'
  4. Publish the DNS records

    Add these three TXT records at your DNS provider. Replace yourcompany.com with your domain and <dkim_public_key> with the dkim_public_key from the previous response.

    PurposeTypeHostValue
    SPFTXT@v=spf1 include:_spf.scrubimail.com ~all
    DKIMTXTscrubimail._domainkeyv=DKIM1; k=rsa; p=<dkim_public_key>
    DMARCTXT_dmarcv=DMARC1; p=none; rua=mailto:[email protected]

    If you already have an SPF record, add include:_spf.scrubimail.com to it instead of creating a second one. A domain with two SPF records fails SPF. Many DNS providers add your domain to the host name for you, so enter only @, scrubimail._domainkey and _dmarc there. The details and the common mistakes are in Sending setup.

  5. Verify the domain

    Once the records are live (usually minutes, occasionally up to 48 hours), ask ScrubiMail to check them. The domain is verified when SPF and DKIM pass. If a check fails, verification_details says which record and why; fix it and call the endpoint again.

    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"

    DMARC is checked too, but only bulk sends and campaigns require it. Publish it anyway: Gmail and Yahoo expect it.

  6. Send your first email

    from_email must be an address on the verified domain, and sending_domain_id is the id from step 3. For a first test, send to your own inbox. The call costs 1 sending credit and answers 202 as soon as the message is accepted.

    curl -X POST "https://api.scrubimail.com/scrubimail/api/v1/send/" \
      -H "X-API-Key: $SCRUBIMAIL_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "sending_domain_id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
      "from_email": "[email protected]",
      "from_name": "Your Company",
      "to_email": "[email protected]",
      "to_name": "Ada Lovelace",
      "subject": "Welcome, {{first_name|there}}!",
      "html_content": "<p>Hi {{first_name|there}}, thanks for joining {{company}}.</p>",
      "text_content": "Hi {{first_name|there}}, thanks for joining {{company}}.",
      "reply_to": "[email protected]",
      "tags": [
        "welcome"
      ],
      "variables": {
        "company": "Kofi Logistics"
      }
    }'

    Keep the message_id from the response. If you leave out text_content, a plain-text version is generated from the HTML.

  7. Check the status

    Delivery is asynchronous. The message starts as sending and moves to delivered or bounced, usually within about a minute.

    curl -X GET "https://api.scrubimail.com/scrubimail/api/v1/send/status/d4e5f6a7-2b3c-4d5e-9f01-a2b3c4d5e6f7/" \
      -H "X-API-Key: $SCRUBIMAIL_API_KEY"

    Open the message in your inbox and view its source: you want to see spf=pass, dkim=pass and dmarc=pass. If it landed in spam, read the Deliverability guide.

Where to go next

Something missing or wrong? Email [email protected].