Purpose postsleuth is used to troubleshoot the question of "why was delivery not successful" on a Postfix mail server. It brings queue, mail log, and DNS diagnostics together in one tool, and can be used either as a command-line tool or as a read-only MCP server, letting AI agents investigate a mail server without modification permissions.
Key capabilities
- Queue and log diagnostics: reads queue information from postqueue -j, mail logs, and DNS, groups each stuck message by the reason it is stuck, and suggests next steps.
- Provider playbooks: when Gmail, Microsoft, or Yahoo rejects mail, the playbook (and the PLAYBOOK section of doctor) identifies the provider code, explains whether Postfix retries are likely to succeed, and gives ordered Postfix-specific recovery steps with links to the provider's official pages. There are 18 playbooks in total, covering scenarios such as Gmail's 4.7.28 rate limit and 5.7.26 DMARC failure, Outlook.com's S3150 blocklist (SNDS, JMRP), and Yahoo's [TSS09]. A single reply can be looked up with postsleuth playbook --reply "…".
- Single-message inspection: message QUEUE_ID reads the envelope and headers via postcat -e -h -q (without reading the body), showing the queue the message is in and when it entered, the status and delay reason for each recipient, the Received route with TLS, whether the DKIM signature aligns with From:, and header issues that may cause rejection, such as bulk mail missing RFC 8058 one-click unsubscribe.
- Redaction by default: output is redacted by default; domains are kept, local parts become [user-1]@example.com, subjects and display names are hidden, and credential-like headers are removed. --unredacted is available only on the CLI.
- Remote and containers: when Postfix is in a container or on another machine, you can use --wrap "docker exec -i mailserver" or run it over ssh.
Usage Binaries are provided for Linux, macOS, and Windows (available from Releases). The demo uses generatedsnapshot data (testdata/gen.py), specified via --queue-file / --log. When run as an MCP server, all tools are read-only, and postfix_queue_message is always redacted. requeue, flush, hold, and delete exist only when the server is started with --allow-mutations, and each call still requires confirm: true.
Use cases Suitable for operations scenarios that need to quickly pinpoint the cause of Postfix delivery failures, look up recovery steps by provider rejection code, check the routing and authentication status of a single message, or let AI agents assist in troubleshooting a mail server in a read-only manner.
Limitations The material does not provide specific installation steps, performance metrics, supported Postfix version ranges, or pricing information. Modification operations are unavailable by default and must be explicitly enabled and confirmed each time; in MCP mode, message output is always redacted.