Email Validation

Validate email addresses before sending to reduce bounces, protect your sender reputation, and improve deliverability. Checks syntax, MX records, disposable domains, role addresses, and common typos.

  • RFC 5322 syntax validation
  • Live MX record lookup
  • Disposable/temporary domain detection
  • Role address detection (admin@, info@, etc.)
  • Free provider detection (gmail, yahoo, etc.)
  • Typo suggestions for common domain misspellings

Validate an Email

POST /v1/emails/validate
validate.ts
import { VeilMail } from '@resonia/veilmail-sdk';

const client = new VeilMail('veil_live_xxxxx');

const result = await client.validation.validate('user@example.com');

console.log(result.verdict); // "valid" | "risky" | "invalid"
console.log(result.score);   // 0.0 to 1.0
console.log(result.checks);  // Detailed check results

Response Format

response.json
{
  "email": "user@example.com",
  "verdict": "valid",
  "score": 0.95,
  "checks": {
    "syntax": { "valid": true },
    "mx": {
      "valid": true,
      "records": ["mx1.example.com", "mx2.example.com"]
    },
    "disposable": { "disposable": false },
    "role": { "role": false },
    "freeProvider": { "free": false }
  },
  "suggestion": null
}

Verdicts

VerdictScoreMeaning
valid≥ 0.8Safe to send. All critical checks passed.
risky0.4 – 0.79Proceed with caution. May be a disposable or role address.
invalid< 0.4Do not send. Invalid syntax, no MX records, or high risk.

Validation Checks

CheckScore ImpactDescription
SyntaxFail = 0.0RFC 5322 format validation
MX RecordsFail = 0.0DNS MX record lookup verifying the domain can receive email
Disposable-0.6Checks against known disposable/temporary email providers
Role Address-0.2Detects generic role addresses (admin@, info@, support@, etc.)
Free Provider-0.1Identifies free email providers (gmail, yahoo, hotmail, etc.)

Batch Validation

POST /v1/emails/validate/batch

Validate up to 100 email addresses in a single request:

batch-validate.ts
const result = await client.validation.validateBatch([
  'valid@example.com',
  'user@mailinator.com',
  'bad-syntax',
  'admin@company.com',
]);

for (const r of result.results) {
  console.log(`${r.email}: ${r.verdict} (score: ${r.score})`);
}
// valid@example.com: valid (score: 0.95)
// user@mailinator.com: invalid (score: 0.3)
// bad-syntax: invalid (score: 0)
// admin@company.com: risky (score: 0.75)

Typo Suggestions

The validator detects common domain misspellings and suggests corrections:

typo-suggestion.ts
const result = await client.validation.validate('user@gmial.com');

console.log(result.suggestion);
// "Did you mean user@gmail.com?"

console.log(result.verdict);
// "invalid" (no MX records for gmial.com)

Common corrections include: gmial.com → gmail.com, yaho.com → yahoo.com, hotmal.com → hotmail.com, outlok.com → outlook.com, and more.

Pre-send Validation Pattern

Use validation before sending to protect your sender reputation:

pre-send.ts
async function safeSend(to: string, subject: string, html: string) {
  // Validate first
  const validation = await client.validation.validate(to);

  if (validation.verdict === 'invalid') {
    throw new Error(`Invalid email: ${to} (score: ${validation.score})`);
  }

  if (validation.verdict === 'risky') {
    console.warn(`Risky email: ${to} - ${JSON.stringify(validation.checks)}`);
    // Decide whether to proceed based on your risk tolerance
  }

  // Safe to send
  return client.emails.send({
    from: 'hello@yourdomain.com',
    to,
    subject,
    html,
  });
}

Rate Limits

Validation endpoints are rate limited to 100 requests/minute for single validation and 10 requests/minute for batch validation. MX lookups involve DNS queries and may add latency.

SDK Support

Email validation is available in the Node.js SDK via client.validation. For other SDKs, use the REST API directly.