Skip to main content

FastAPI

Project description

identify-fake-email

A Python SDK for the Email Validator API — ML-powered email validation that goes beyond blacklists.

Most validators rely on MX records, SMTP checks, or static blacklists. This API combines traditional checks with an XGBoost model that scores the risk of accepting an email based on patterns in the username and domain — catching auto-generated disposable emails that traditional methods miss.

Installation

pip install identify-fake-email

Requirements

  • Python 3.7+
  • A RapidAPI key (free tier available — 100 requests/month)

Quick Start

import identify_fake_email
from identify_fake_email.api.default_api import DefaultApi
from identify_fake_email.configuration import Configuration

RAPIDAPI_KEY = "YOUR_RAPIDAPI_KEY"
RAPIDAPI_HOST = "email-validator-syntax-mx-disposable-risk-detection.p.rapidapi.com"

config = Configuration()
config.host = f"https://{RAPIDAPI_HOST}"

client = DefaultApi(identify_fake_email.ApiClient(config))

result = client.validate_email_validate_get(
    "user@example.com",
    _headers={
        "x-rapidapi-key": RAPIDAPI_KEY,
        "x-rapidapi-host": RAPIDAPI_HOST
    }
)

print(f"Valid: {result.valid_email}")
print(f"Name risk: {result.name_risk}")

if result.name_risk > 0.7 or not result.valid_email:
    print("Suspicious - review")
else:
    print("Safe to accept")

Bulk Validation

Validate up to 30 emails per request.

from identify_fake_email.models.bulk_emails import BulkEmails

bulk = BulkEmails(emails=["user1@example.com", "user2@example.com"])

results = client.validate_bulk_validate_bulk_post(
    bulk,
    _headers={
        "x-rapidapi-key": RAPIDAPI_KEY,
        "x-rapidapi-host": RAPIDAPI_HOST
    }
)

for result in results:
    print(f"{result.email}: name_risk={result.name_risk}")
    if result.name_risk > 0.7 or not result.valid_email:
        print("Suspicious - review")
    else:
        print("Safe to accept")

Response Fields

Field Type Description
email string The email address validated
valid_email_structure bool Whether the email has valid syntax
is_role bool Whether it's a role address (e.g. admin@, support@)
mx_records bool Whether the domain has valid MX records
not_disposable bool Whether the domain is on the disposable blacklist
new_domain bool Whether the domain was recently created
name_risk float (0–1) ML risk score for the username — higher means riskier
domain_risk float (0–1) ML risk score for the domain — higher means riskier
valid_email bool Overall validity based on traditional checks

Risk Scores

name_risk and domain_risk are ML-generated scores between 0 and 1. The higher the score, the more likely the email is fake or disposable.

name_risk is the more reliable of the two — auto-generated usernames follow distinct patterns (random characters, high digit count, unusual consonant/vowel ratios) that the model picks up on. domain_risk is less reliable as auto-generated domains can look similar to legitimate ones.

We recommend using name_risk as your primary signal and combining it with other fields for the most accurate result. The threshold is up to you — 0.7 is a reasonable starting point but you can adjust it for your use case.

Notes

  • SMTP validation is intentionally excluded — disposable emails have real mailboxes so SMTP returns valid, adding latency with no benefit
  • Bulk validation supports up to 30 emails per request
  • The SDK is auto-generated from the OpenAPI spec — RapidAPI headers must be passed directly to each method call via _headers

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

identify_fake_email-1.0.4.tar.gz (27.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

identify_fake_email-1.0.4-py3-none-any.whl (31.6 kB view details)

Uploaded Python 3

File details

Details for the file identify_fake_email-1.0.4.tar.gz.

File metadata

  • Download URL: identify_fake_email-1.0.4.tar.gz
  • Upload date:
  • Size: 27.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for identify_fake_email-1.0.4.tar.gz
Algorithm Hash digest
SHA256 7d18b08583e57ba5b22f7f82227d802c60da79238714875904d06bb9741d7e75
MD5 5ee76567bbc9903b099f3d396bdb0175
BLAKE2b-256 de3fa19a99681fa82de6a787165c605d1428127167636c504fa9a58b64c618f9

See more details on using hashes here.

File details

Details for the file identify_fake_email-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for identify_fake_email-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f73b32246d200e05374050a622b6b4fbd482eafa0e5a5555c2742933ba73f4da
MD5 16836a97562ab291d6dc273d9da26ded
BLAKE2b-256 d049e6660e884e9ba0cda2b2e57eb614f08da5101fb1f485ddf88f24d8605541

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page