Veille
Guias práticos

Validate Email on Signup

Verify whether an email address is real and deliverable at the point of registration using the Veille email validation API — including syntax, DNS, and mailbox checks.

Overview

This playbook shows how to run a full email validation before accepting a signup: syntax check, DNS/MX record lookup, and SMTP reachability. The API returns a risk_score (0 = clean, 100 = high risk) that you can use to route users to extra verification steps.

Prerequisites

  • A Veille API key — get one at app.veille.io
  • Install dependencies for your language:
pip install requests

Steps

Validate an email address

Call GET /v1/email with the email parameter.

import requests

API_KEY  = "YOUR_API_KEY"
response = requests.get(
    "https://api.veille.io/v1/email",
    headers={"x-api-key": API_KEY},
    params={"email": "alice@example.com"},
)
result = response.json()
print(result)

Interpret the result

Key fields: is_valid, is_deliverable, is_disposable, is_role_account, risk_score, did_you_mean (typo suggestion).

print(f"Valid       : {result['is_valid']}")
print(f"Deliverable : {result['is_deliverable']}")
print(f"Disposable  : {result['is_disposable']}")
print(f"Role account: {result['is_role_account']}")
print(f"Risk score  : {result['risk_score']}/100")
if result.get("did_you_mean"):
    print(f"Did you mean: {result['did_you_mean']}?")

Build a risk-tiered registration flow

Use risk_score to route users: block high-risk addresses, prompt typo corrections, and apply extra friction to role accounts.

import requests

API_KEY = "YOUR_API_KEY"

def validate_email(email: str) -> dict:
    r = requests.get("https://api.veille.io/v1/email",
        headers={"x-api-key": API_KEY}, params={"email": email})
    return r.json()

def register(email: str) -> dict:
    v = validate_email(email)

    if not v.get("is_valid"):
        return {"ok": False, "error": "This email address is invalid."}

    if v.get("is_disposable"):
        return {"ok": False, "error": "Temporary email addresses are not accepted."}

    if v.get("did_you_mean"):
        return {"ok": False, "suggestion": f"Did you mean {v['did_you_mean']}?"}

    if v.get("risk_score", 0) >= 70:
        return {"ok": False, "error": "This email has a high risk score. Please use a different address."}

    if v.get("is_role_account"):
        # Allow but flag for manual review
        return {"ok": True, "flag": "role_account", "message": "Please verify your email."}

    return {"ok": True, "message": "Registration successful!"}

for test_email in ["alice@mailinator.com", "info@company.com", "alice@gmial.com", "alice@stripe.com"]:
    print(f"{test_email}: {register(test_email)}")

Role accounts (admin@, info@, support@) are often monitored by multiple people — or not monitored at all. Flag them for manual review rather than blocking outright to avoid losing legitimate B2B signups.

Nesta página