A unified operational toolkit for email server administration and DMARC analysis.
Project description
Mail Ops Scripts
A unified operational toolkit for email server administration, security analysis, and reporting.
๐ Now available on PyPI!
You can now install mailops globally with a single command.
โก Quick Start
Get the CLI installed directly from PyPI and start managing your mail operations in seconds.
# Install via pip
pip install mail-ops-scripts
# Verify installation
mailops --help
๐ The Toolkit
mailops is a single binary aimed at simplifying the fragmented world of email admin. No more juggling random bash scripts or online DNS checkers.
| Command | Description |
|---|---|
mailops fetch |
Connects to Gmail/Exchange via IMAP to download DMARC reports. |
mailops report |
Parses XML reports (.xml, .gz, .zip) from a folder or file into readable tables or CSVs. |
mailops spf |
Validates SPF records using Google's DNS-over-HTTPS (secure & cached). |
mailops dkim |
Generates 2048-bit RSA keys and formats the exact DNS TXT record you need. |
๐ Common Workflows
1. The "Monday Morning" Check
Grab the last week's DMARC reports from your dedicated inbox and see if anyone is spoofing you.
# 1. Download reports from your dmarc@ account
mailops fetch --user admin@example.com --password "app-password" --days 7
# 2. Analyze the data (view alerts only)
mailops report --alerts
2. Setting Up a New Domain
Spinning up a new sender? Generate your security keys and validate your DNS instantly.
# 1. Generate DKIM keys (outputs to ./default.private)
mailops dkim example.com --selector=mail
# 2. Verify your SPF record is live and valid
mailops spf example.com
3. Generate DMARC Analysis Report
Analyze reports in your current directory, a specific folder, or even a single file.
# Display all records in current directory
mailops report
# Analyze reports in a specific folder
mailops report ./my_logs/
# Analyze a single XML file
mailops report report.xml
# Export all records to CSV
mailops report --csv dmarc_analysis.csv
๐ Report Command Features
The mailops report command analyzes DMARC XML reports and provides:
- Formatted Tables: Color-coded analysis of SPF, DKIM, and DMARC policy results
- Alert Filtering:
--alertsflag to show only authentication failures and spoofing attempts - CSV Export:
--csvflag to save results for further analysis - Compressed Format Support: Automatically handles
.xml,.xml.gz, and.zipfiles - Organized Output: Groups results by organization and date range
Report Output Example
$ mailops report
๐ Analyzing REAL DMARC reports...
Found 5 XML files:
๐ enterprise.protection.outlook.com!example.com!1765324800!1765411200.xml.gz
...
Report: enterprise.protection.outlook.com (2025-12-01)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Source IP | Hostname | Cnt | SPF | DKIM | Analysis
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
192.168.1.1 | mail.example.com | 42 | pass | pass | OK
10.0.0.5 | suspicious.domain | 3 | fail | fail | INVESTIGATE
๐ฆ Developer Setup
If you want to contribute or modify the scripts, here is how to get the dev environment running locally.
# Clone and setup
git clone https://github.com/knowoneactual/mail-ops-scripts
cd mail-ops-scripts
# Create virtual env
python -m venv .venv
source .venv/bin/activate
# Install in editable mode with dev dependencies
pip install -e '.[dev]'
# Run the test suite
pytest
# Format and lint code with Ruff (fast & unified)
ruff format .
ruff check --fix .
๐ค Contributing
We want to keep this lightweight and portable.
- Standard Libs First: Trying to avoid external dependencies to ensure the tool runs anywhere.
- Code Style: UsingRuff for high-performance, unified linting and formatting.
- See details: Check CONTRIBUTING.md for the full guide.
๐ License
MIT ยฉ KnowOneActual
Made with โค๏ธ for email operations
๐บ๏ธ Roadmap
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
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
File details
Details for the file mail_ops_scripts-2.5.2.tar.gz.
File metadata
- Download URL: mail_ops_scripts-2.5.2.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1143b76a74dfe45ff9e79c99d6eb2e9f975652e66b6998ca86309cb80eb0c48
|
|
| MD5 |
86266b8afd2f0a1c903699b2a4002eb0
|
|
| BLAKE2b-256 |
1d86cc2180648f31e3443f4f80380bd491382e49d873476aff17baf0b1b64677
|
File details
Details for the file mail_ops_scripts-2.5.2-py3-none-any.whl.
File metadata
- Download URL: mail_ops_scripts-2.5.2-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d73e02ec4bb1bb0af39442217accf36e998cff1addf0f2496724ff828c35292
|
|
| MD5 |
076062633ac9f6782b2cf583d609244f
|
|
| BLAKE2b-256 |
05d51dfbc3bfeb8507d376dae205693012157d570980688d3091dc0a048a5e3e
|