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) into readable tables or CSVs with alerts. |
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
Export your DMARC data to CSV for security team review or further analysis.
# Display all records in formatted table
mailops report
# Export all records to CSV
mailops report --csv dmarc_analysis.csv
# Export only authentication failures to CSV
mailops report --alerts --csv security_alerts.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 code with black
black mailops/
# Sort imports with isort
isort mailops/
๐ค Contributing
We want to keep this lightweight and portable.
- Standard Libs First: We try to avoid external dependencies to ensure the tool runs anywhere.
- Code Style: We use
blackandisort. - 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.1.tar.gz.
File metadata
- Download URL: mail_ops_scripts-2.5.1.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dfe00563b551fa8ffeb5c10944ebf674378e4259ec3fb010c0c93caea1bbddc
|
|
| MD5 |
737c290861d83115fddd27c3b8e5a378
|
|
| BLAKE2b-256 |
29491b1a4587c38ea41ae3f8ce515ea3e8bcc614f577557c125df68ad2e9e37e
|
File details
Details for the file mail_ops_scripts-2.5.1-py3-none-any.whl.
File metadata
- Download URL: mail_ops_scripts-2.5.1-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
840db9a2e57132cfb5938a93c4aae92f5b060e14fcea3b9c99fa5669b96571c0
|
|
| MD5 |
9562b9b3e257046a2500c38d4fe3a93e
|
|
| BLAKE2b-256 |
95d1e8b1ca0a6aaf60600f4393bc100918cd4b0663acb55bcf3bdc475808de24
|