DMARC library and milter module implemented in Python.
Project description
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
>>> from dmarc.tests.report.test_report import TEST_XML_DOCUMENT
>>> adict = DMARCRelaxedSchema.to_dict(TEST_XML_DOCUMENT)
>>>
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dmarc-1.1.3.tar.gz
(33.4 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
dmarc-1.1.3-py3-none-any.whl
(37.8 kB
view details)
File details
Details for the file dmarc-1.1.3.tar.gz.
File metadata
- Download URL: dmarc-1.1.3.tar.gz
- Upload date:
- Size: 33.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbbfc955ab9cb719a997075c89371c07c81909a8ca688e3079477d23986849d0
|
|
| MD5 |
84d1228fba30705bd4a9c585a6ea26e9
|
|
| BLAKE2b-256 |
d646ae4561951fb3cd41d7af3f0d9978de619b4a51b56ad1c136ebf6dbb0d51e
|
File details
Details for the file dmarc-1.1.3-py3-none-any.whl.
File metadata
- Download URL: dmarc-1.1.3-py3-none-any.whl
- Upload date:
- Size: 37.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c070c97594e63d8601b0f1ada842abc0b8b5cd0475e77b805acbf029fc32912
|
|
| MD5 |
a9c8c09ef4b39b19b4a3b045898b458c
|
|
| BLAKE2b-256 |
90905b1c91da76452b9a62bf323481730f242bff61ca3580d86b3fdfac6dd5f9
|