Skip to main content

Client for the CanItSend API — SPF/DKIM/DMARC audit from live DNS, SPF flattening, and email validation.

Project description

canitsend-client

Zero-dependency Python client for the CanItSend API. Two questions, one API.

pip install canitsend-client

Every endpoint needs an API key. The free tier includes 100 audits/month — instant and self-serve: https://canitsend.com/#pricing

from canitsend import CanItSendClient
cis = CanItSendClient(api_key="snd_live_...")

1. Can my domain send?

a = cis.check("acme.com")          # also accepts "you@acme.com" or a URL
print(a["grade"], a["score"])      # F 40

# Plain-language answer to "but my email works!"
print(a["explanation"]["headline"])
# -> "Your mail works — but you can't prove you sent it."

# The exact records to paste, chosen for YOUR detected mail provider
for r in a["suggestedRecords"]:
    print(r["type"], r["host"], r["value"])
# -> TXT @       v=spf1 include:_spf.google.com ~all
# -> TXT _dmarc  v=DMARC1; p=none; rua=mailto:dmarc@acme.com

The SPF 10-lookup limit

Over 10 DNS lookups means PermError — SPF fails entirely, not partially. We count it correctly: mx costs 1, not one per MX host. Most tools get this wrong.

spf = cis.spf_check("acme.com")
print(spf["lookupCount"], "/ 10", "PermError!" if spf["lookupLimitExceeded"] else "")

print(cis.spf_flatten("acme.com")["flattened"])   # zero include-lookups

2. Should I send to this address?

v = cis.validate("jane@gmial.com")
print(v["verdict"])      # risky
print(v["didYouMean"])   # jane@gmail.com

cis.validate("test@mailinator.com")   # risky   - disposable
cis.validate("support@acme.com")      # risky   - role account
cis.validate("x@no-such.dev")         # invalid - no MX, will bounce

What we don't claim: we do not verify the mailbox exists and do not detect catch-alls. Both require an SMTP probe on port 25, which we deliberately do not run. mailboxVerified is always False. The strongest verdict is deliverable_domain — the domain accepts mail.

Bulk (Agency+): audit_bulk([...]) up to 100 domains · validate_bulk([...]) up to 1,000 addresses.

Errors raise CanItSendError with .status and .problem (RFC 9457).

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

canitsend_client-1.0.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

canitsend_client-1.0.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file canitsend_client-1.0.0.tar.gz.

File metadata

  • Download URL: canitsend_client-1.0.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for canitsend_client-1.0.0.tar.gz
Algorithm Hash digest
SHA256 399a2a27832fc9dadfd7d03a0da62c63af4f5d3f5696d4e2b09732c3df911535
MD5 4e4f1bd70ff7afb1f158376a1c7a2891
BLAKE2b-256 2745b2da4e6d83e2b7b5b789d14bc09f43d01473d34feae0b48a5c17c7d5f8a1

See more details on using hashes here.

File details

Details for the file canitsend_client-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for canitsend_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c8e149c335cdfb2e1578880b1023e697c56ac9b75befc25382b75dbc45a7dc15
MD5 9e84848be53cddd5741791738993b387
BLAKE2b-256 8c23aa3c134a40ebefa0de75d89013071a40ad9938364f3fc060f426275f711e

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