Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Parse and evaluate DMARC email authentication policy

Project description

DMARC (Domain-based Message Authentication, Reporting & Conformance)

This module allows an application to parse and evaluate email authentication policy, to application supplied TXT RR, SPF and DKIM results.

Installation

Use the package manager pip to install dmarc.

pip install dmarc

Usage

>>> import dmarc

# represent verified SPF and DKIM status
>>> aspf = dmarc.SPF(domain='news.example.com', result=dmarc.SPF_PASS)

>>> adkim = dmarc.DKIM(domain='example.com', result=dmarc.DKIM_PASS)

>>> d = dmarc.DMARC()

# parse policy TXT RR
>>> p = d.parse_record(record='v=DMARC1; p=reject;', domain='example.com')

# evaluate policy
>>> r = d.get_result(p, spf=aspf, dkim=adkim)

# check result
>>> r.result == dmarc.POLICY_PASS
True

# check disposition
>>> r.disposition == dmarc.POLICY_DIS_NONE
True

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.

Files for dmarc, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size dmarc-1.0.1-py3-none-any.whl (5.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size dmarc-1.0.1.tar.gz (4.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page