DMARC (Domain-based Message Authentication, Reporting & Conformance)
DMARC email authentication module implemented in Python.
Installation
Use the package manager pip to install dmarc.
$ pip install dmarc
Usage
>>> from dmarc import SPFAuthResult, DKIMAuthResult, SPFResult, DKIMResult, DMARCPolicy
>>> # Represent verified SPF and DKIM identifiers
>>> spf = SPFAuthResult('news.example.com', SPFResult('pass'))
>>> dkim = DKIMAuthResult('example.com', DKIMResult('pass'))
>>> policy = DMARCPolicy(record='v=DMARC1; p=reject;', domain='example.com')
>>> policy.verify(auth_results=[spf, dkim])
>>>
>>> # RR resolver example
>>> from dmarc.resolver import resolve, RecordNotFoundError, RecordMultiFoundError
>>> from dmarc.psl import get_public_suffix
>>> domain = 'news.example.com'
>>> try:
... record = resolve(domain)
... except (RecordNotFoundError, RecordMultiFoundError):
... org_domain = get_public_suffix(domain)
... if org_domain != domain:
... record = resolve(org_domain)
...
>>> # Aggregate report XML document to dict example
>>> from dmarc.report import DMARCRelaxedSchema, DMARC2Schema
>>> from dmarc.tests.report.test_report import TEST_XML_DOCUMENT, TEST_XML_DOCUMENT_2
>>> relaxed = DMARCRelaxedSchema.to_dict(TEST_XML_DOCUMENT)
>>> rfc9990 = DMARC2Schema.to_dict(TEST_XML_DOCUMENT_2)
>>>
Milter configuration with Postfix
- Start
dmarc.miltermodule or run via Systemd — seecontrib/. - Start a Postfix instance with a configuration like
smtpd_milters = inet:127.0.0.1:9000
Described here 👉 Run DMARC Milter with Postfix.
License
Metadata
Release files for dmarc 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dmarc-1.2.2.tar.gz | 29.8 kB | Without provenance | Details for dmarc-1.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dmarc-1.2.2-py3-none-any.whl | Python 3 | none | any | Details for dmarc-1.2.2-py3-none-any.whl |
Total release size: 64.2 kB
Release files / dmarc-1.2.2.tar.gz
| Download URL | dmarc-1.2.2.tar.gz |
|---|---|
| Size | 29.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6332c6453828c1c550462e1f19b687ae7e61603c652ae3023ac7fa83b20c125
|
|
BLAKE2b-256 checksum How to use checksums |
2d5b3658f1cc38ee0bc8407267b3e1a8a69e013c8c83f405580a662d54ee74a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / dmarc-1.2.2-py3-none-any.whl
| Download URL | dmarc-1.2.2-py3-none-any.whl |
|---|---|
| Size | 34.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f1d2aa1c05efc25dc01b0ea1633b743f2ad3d57d67fe31d73a6828eda6c4ea2
|
|
BLAKE2b-256 checksum How to use checksums |
b669b696a33fdadb97ce979d7eb5add5e2d3aa40f940a59f1ecdb9adffa7e689
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for dmarc 1.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.