Skip to main content

simple-dmarc-parser

simple-dmarc-parser is a basic Python script that reads the contents of an IMAP mailbox, seeks out DMARC RUA reports, downloads and parses them in aggregate to provide a basic summary of passes and failures.

Function

The script will print any DMARC reports which had a failed result, so that you can review them. A summary will also be printed at the end by default, which shows how many reports had a pass/fail result from each provider, how many pass/fail results were found for each IP address, and how many pass/fail results were found for each domain.

The summary can be disabled if you only want to see failures. See the usage section for appropriate options.

Installation

It's recommended that you install simple-dmarc-parser via pip so that it is available on the system:

pip install simple-dmarc-parser

Usage

The script reads all unread messages in the mailbox provided, so you should only use this with a dedicated DMARC RUA address. simple-dmarc-parser does not process RUF reports.

simple-dmarc-parser accepts command line arguments, a config file, or it can prompt you for the IMAP server information.

Run simple-dmarc-parser -h for command line argument options. Or, just run simple-dmarc-parser and you will be prompted for the appropriate information. Your password will not be shown as you enter it.

A config file option is recommended for any sort of automation so that your credentials aren't potentially exposed in process lists. See the example config file, place it in an appropriate location with sensible permissions, and run using simple-dmarc-parser --config /path/to/config

Use the delete messages option with caution. Messages deleted with this option are not put in a deleted folder. They are immediately removed from the IMAP server with no option for recovery.

Automatic Reports

You can use cron to run simple-dmarc-parser regularly and send you its output via email, or whatever source you can send to via the command line.

For example, the following cron entry running on your mail server will result in nightly DMARC summaries being sent by cron to the user running the job:

0 0 * * * simple-dmarc-parser --config /path/to/config

If you prefer a version that only notifies you on errors, you can use this example script. Make sure you have mailutils installed, put the script in root's home directory, and install the following cronjob as root:

0 0 * * * /root/dmarc_report.sh

The script assumes your configuration is in /etc/simple-dmarc-parser.conf (make sure silent is true), and it will send its report to the root user on the local system. If you wish to send to send the reports off-system, change "root" to a full email address.

Metadata

Release files for simple-dmarc-parser 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-dmarc-parser 1.1.0
File Size Uploaded
simple_dmarc_parser-1.1.0.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-dmarc-parser 1.1.0
File Interpreter ABI Platform
simple_dmarc_parser-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 kB

Release files / simple_dmarc_parser-1.1.0.tar.gz

Download URL simple_dmarc_parser-1.1.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6d9cfac0ca6e221bfcf7bac6c56e75939fc1fe43d7110cc8f98aece9b76c119d
BLAKE2b-256 checksum
How to use checksums
bbc6702260ec945aca6ec33770fccb52d27cc509c5d41005df1ae6bf1b62558f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.12.4 Windows/11

Release files / simple_dmarc_parser-1.1.0-py3-none-any.whl

Download URL simple_dmarc_parser-1.1.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dbde2a77f02d0e8b411f9fb38f5f0ec1f1780d8695d75930c228aa92cb750a87
BLAKE2b-256 checksum
How to use checksums
abd53e329972527ec532b73257985ec71cd08c7e7ff1562188831e15de2314f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.12.4 Windows/11

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page