⚡ fadsync-mailcheck
The Official Python SDK, FastAPI Guard, and Django Validator for FadSync MailCheck.
Block 40M+ disposable burner email domains, autocorrect typos, verify DNS MX servers, and protect authentication pipelines with sub-50ms latency.
🚀 Features
- 🚫 40M+ Disposable Email Detection: Real-time identification of burner domains (10minutemail, GuerrillaMail, Mailinator, etc.).
- ⚡ Sync & Async (
httpx): Native asynchronous and synchronous clients for high-throughput backends. - 🛡️ FastAPI & Django Integrations: 1-line route dependencies (
FastAPIEmailGuard) and Django form/model validators. - 💡 Smart Typo Autocorrect: Catches and suggests fixes for common domain mistakes (
user@gamil.com➔user@gmail.com). - ⚡ Thread-Safe In-Memory Cache: Built-in TTL caching with LRU eviction to minimize upstream API calls.
- 🔄 Fail-Safe Resilience (
fail_silent=True): Network timeouts and blips never break user signups. - 🔑 Direct Authentication: Seamless connection with standard FadSync API keys (
Authorization: Bearer <API_KEY>). - 📘 Fully Typed (PEP 561): First-class Pydantic models with complete type hints for PyCharm and VS Code.
📦 Installation
# Core SDK (Sync + Async)
pip install fadsync-mailcheck
# With FastAPI integration
pip install "fadsync-mailcheck[fastapi]"
# With Django integration
pip install "fadsync-mailcheck[django]"
# All integrations
pip install "fadsync-mailcheck[all]"
🔑 Getting Your API Key
- Sign up for a free account at https://mailcheck.fadsync.com/.
- Copy your API Key from the Developer Dashboard.
- Pass it to the client or set the
FADSYNC_API_KEYenvironment variable.
⚡ Quickstart
1. Synchronous Python Usage
from fadsync_mailcheck import FadSyncMailCheck
client = FadSyncMailCheck(api_key="YOUR_FADSYNC_API_KEY")
result = client.verify("tester@10minutemail.com")
if result.is_blocked:
print(f"❌ Blocked: {result.user_friendly_message}")
# Output: "Temporary and disposable email addresses are not permitted. Please use a permanent email."
else:
print(f"✅ Safe to register! Risk score: {result.risk_score}/100")
2. Asynchronous Python Usage (asyncio)
import asyncio
from fadsync_mailcheck import AsyncFadSyncMailCheck
async def main():
async with AsyncFadSyncMailCheck(api_key="YOUR_FADSYNC_API_KEY") as client:
result = await client.verify("alex.hunter@gmail.com")
print(f"Domain: {result.domain}, Has MX: {result.has_valid_mx}")
asyncio.run(main())
3. FastAPI Route Guard Dependency
from fastapi import FastAPI, Depends, status
from pydantic import BaseModel, EmailStr
from fadsync_mailcheck import FastAPIEmailGuard, ValidationResult
app = FastAPI(title="Secured SaaS API")
# Initialize Guard
email_guard = FastAPIEmailGuard(
api_key="YOUR_FADSYNC_API_KEY",
block_disposable=True, # Blocks 40M+ burner domains
block_dead_mx=True, # Rejects dead mail domains
)
class SignupRequest(BaseModel):
name: str
email: EmailStr
password: str
@app.post("/api/signup", status_code=status.HTTP_201_CREATED)
async def signup(
payload: SignupRequest,
check: ValidationResult = Depends(lambda req: email_guard(req.email)),
):
# Email is 100% verified, safe, and MX active!
return {
"success": True,
"message": f"Welcome {payload.name}!",
"risk_score": check.risk_score,
}
4. Django Form & Model Field Validator
from django.db import models
from fadsync_mailcheck import FadSyncEmailValidator
class UserProfile(models.Model):
username = models.CharField(max_length=150, unique=True)
email = models.EmailField(
unique=True,
validators=[FadSyncEmailValidator(block_disposable=True)],
)
⚙️ Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
api_key |
str |
os.getenv("FADSYNC_API_KEY") |
Your FadSync API Key |
base_url |
str |
https://mailcheck.fadsync.com/api/v1 |
API base URL |
timeout |
float |
3.0 |
Request timeout in seconds |
cache |
bool | InMemoryCache |
True (300s TTL) |
Thread-safe in-memory cache |
fail_silent |
bool |
True |
Fail-open gracefully on timeouts/errors |
📊 Result Object Attributes
| Attribute | Type | Description |
|---|---|---|
result.email |
str |
Normalized email address |
result.is_disposable |
bool |
True if temporary burner email |
result.is_valid_format |
bool |
True if RFC format is valid |
result.has_valid_mx |
bool |
True if DNS MX mail server records exist |
result.risk_score |
int |
Fraud risk rating from 0 (clean) to 100 (high risk) |
result.typo_fix |
str | None |
Suggested domain autocorrection |
result.has_typo_suggestion |
bool |
True if typo replacement is available |
result.is_safe_to_register |
bool |
Convenient boolean check for signups |
result.user_friendly_message |
str |
Non-technical explanation ready for UI display |
📄 License
MIT © FadSync
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fadsync_mailcheck-1.0.0.tar.gz
(16.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fadsync_mailcheck-1.0.0.tar.gz.
File metadata
- Download URL: fadsync_mailcheck-1.0.0.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd77a0d06443742210e968223e770ea539955c07a2fd23fcd16ce0e49b3ce3dd
|
|
| MD5 |
a4cb37bc6bf8823654ed80eb9c424089
|
|
| BLAKE2b-256 |
734892af76f0683a28e31faa48ed8f7032a3aa0eac7f487c8927e1079f3ba3a0
|
File details
Details for the file fadsync_mailcheck-1.0.0-py3-none-any.whl.
File metadata
- Download URL: fadsync_mailcheck-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21d77aa53509c318e54c02d3b52bb35d08861ef2d9428a14952d54439bb3249e
|
|
| MD5 |
e563ad43a3a124f9bc2dd11138dc9cd2
|
|
| BLAKE2b-256 |
a5158086f01b97f03647ab3c2d86481d3b2f18801026abac5f5dc32a66ffbfa9
|