Email Validator: Validation

Validate Email

Check one address before you send to it: format, domain, MX, temporary providers, typos, spam traps and whether the mailbox really exists.

POSThttps://g.sendcorex.com/v1/tool/validatecommand: validate_email
i

Needs the tools:validate scope on your API key.

i

Uses 1 validation credit.

Arguments

  • emailstringrequired

    The address to check. Up to 254 characters.

    e.g. "ana@acme.com"

Quick start

import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1/tool/validate',
  {
    commands: [
      {
        command: "validate_email",
        args: {
          email: "ana@acme.com"
        }
      }
    ]
  },
  { headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);

const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);

Response

{
  "type": "SUCCESS",
  "results": [
    {
      "command": "validate_email",
      "id": "0",
      "type": "SUCCESS",
      "took_ms": 18,
      "data": {
        "email": "ana@acme.com",
        "valid": true,
        "checks": [
          {
            "check": "Format Validation",
            "status": "Passed",
            "details": "Valid email format"
          },
          {
            "check": "Local Part Validation",
            "status": "Passed",
            "details": "Local part is RFC compliant"
          },
          {
            "check": "Role-based Email Check",
            "status": "Passed",
            "details": "Not a role-based address"
          },
          {
            "check": "No-reply Email Check",
            "status": "Passed",
            "details": "Not a no-reply address"
          },
          {
            "check": "Temporary Email Check",
            "status": "Passed",
            "details": "Not a temporary email"
          },
          {
            "check": "Misspelled Domain Check",
            "status": "Passed",
            "details": "Correct"
          },
          {
            "check": "Spam Trap Check",
            "status": "Passed",
            "details": "Not a spam trap"
          },
          {
            "check": "Provider Type",
            "status": "Passed",
            "details": "Corporate or custom domain"
          },
          {
            "check": "Domain Validation",
            "status": "Passed",
            "details": "Domain is valid and has MX records"
          },
          {
            "check": "Null MX Check",
            "status": "Passed",
            "details": "Domain accepts email"
          },
          {
            "check": "Email Provider Detection",
            "status": "Passed",
            "details": "Domain is hosted on a known provider: Google Workspace",
            "providerId": 1,
            "providerName": "Google Workspace"
          },
          {
            "check": "Email Deliverability",
            "status": "Passed",
            "details": "Mailbox exists",
            "fullResponse": "250 2.1.5 OK"
          },
          {
            "check": "Catch-all Mail Exchanger Check",
            "status": "Passed",
            "details": "Mail exchanger correctly rejects nonexistent addresses"
          }
        ]
      }
    }
  ]
}

Response fields

  • email

    The address, trimmed and in lowercase.

  • valid

    true only when every check passed. Provider Type and Email Provider Detection are informative and never make it false.

  • checks[].check

    The name of the check. See Checks below.

  • checks[].status

    Passed or Failed.

  • checks[].details

    A sentence explaining the result, ready to show to a user.

  • checks[].fullResponse

    Only on Email Deliverability: the exact answer of the mailbox server.

  • checks[].providerId / providerName

    Only on Email Provider Detection: the mailbox provider that hosts the domain.

Checks

They run in this order and stop early when there is no point going on (no MX, bad format…).

  • Format Validation

    The address has a valid shape. If it fails, nothing else runs.

  • Local Part Validation

    The part before @ follows RFC 5322 (length, dots, characters).

  • Role-based Email Check

    Informative: tells you if it is a team address like info@ or admin@. Never fails.

  • No-reply Email Check

    Fails for noreply@ and similar addresses, which do not read what they get.

  • Temporary Email Check

    Fails for disposable and temporary providers.

  • Misspelled Domain Check

    Fails for common typos of big providers (gmial.com, hotmial.com…) and suggests the right one.

  • Spam Trap Check

    Fails for domains known to be spam traps.

  • Provider Type

    Informative: free/personal provider or a corporate domain.

  • Domain Validation

    The domain exists and has MX records.

  • Null MX Check

    Fails when the domain says it does not accept email (RFC 7505).

  • Email Provider Detection

    Informative: the mailbox provider, when we know it.

  • Email Deliverability

    We ask the mailbox server if the address exists, without sending anything. Only runs when every check above passed.

  • Catch-all Mail Exchanger Check

    Only for corporate domains. Fails when the server accepts any address, so the mailbox cannot be confirmed.

Using the result

  • Block the signup

    When valid is false, show the details of the first failed check to the user.

  • Suggest the fix

    Misspelled Domain Check comes with the corrected address in details: offer it with one click.

  • Catch-all

    A failed catch-all check means the server accepts anything. The address may exist, but nobody can prove it before sending.

Errors

HTTP-level errors return type, code and message. Errors marked CMD come back inside the command result, with HTTP 200.

  • 401INVALID_API_KEY

    The API key does not exist, was revoked or was disabled in the dashboard.

  • 429RATE_LIMITED

    More than 75 requests/s or 75 in flight for the same IP + API key. Wait the number of seconds in Retry-After.

  • CMDMISSING_SCOPE

    The API key does not have `tools:validate`.

  • CMDINVALID_ARGS

    An argument is invalid: missing email (or domain, for `check_disposable`), more than 50 emails, an address longer than 254 characters, limit out of range…

  • CMDINSUFFICIENT_CREDITS

    You do not have enough credits for the whole command (validation credits for `validate_*`, disposable credits for `check_disposable`). Nothing was checked and nothing was charged.

  • CMDCREDITS_UNAVAILABLE

    Your credits could not be read right now. Nothing was charged. Try again.

  • CMDNO_SERVERS_AVAILABLE

    No validation server is available right now. Nothing was charged. Try again shortly.

  • CMDVALIDATION_FAILED

    The validation servers did not answer in time. Your credits were returned. Try again.

  • CMDINTERNAL

    Server error. The detail is only written to the server log.