Why I Built PMGSuite for Proxmox Mail Gateway
While managing systems that use Proxmox Mail Gateway, I noticed that I was repeating the same operational tasks again and again. Adding large lists of email addresses to a Who Object, removing outdated domains, checking quarantine messages, or managing the Postfix queue usually meant remembering several separate commands and API paths.
I wanted to make these daily tasks simpler, so I built PMGSuite. PMGSuite is an interactive Bash-based management tool for Proxmox Mail Gateway. My goal was not to replace the Proxmox interface, but to create a fast and practical command-line tool for the repetitive operations that are often easier to handle in batches.
The project brings several common PMG tasks together in one menu. With PMGSuite, I can add email addresses and domains to a Who Object in bulk. The script can automatically detect whether each line is an email address or a domain, or it can work in email-only and domain-only modes. Existing records are checked before insertion so that unnecessary duplicate requests are avoided.
The same approach is available for bulk deletion. I can remove selected email addresses or domains from a Who Object, or delete all records after an explicit confirmation. Regex, IP address, and CIDR network records can also be added and removed through the dedicated Who Object management module.
PMGSuite also includes tools for quarantine and mail flow operations. Quarantine messages can be filtered by sender, recipient domain, and optional date ranges. Before delivering messages, I can use dry-run mode to review the matching records without making any changes. This is especially useful when working with a large quarantine and wanting to reduce the risk of delivering the wrong messages.
Another part of the project focuses on allowlists and blocklists. Email addresses, domains, regular expressions, IP addresses, and networks can be listed, added, or removed. The script also provides basic Postfix queue management, including queue listing, message deletion, queue clearing, and flushing operations.
I built the tool around the Proxmox Mail Gateway command-line API, using `pmgsh` for the actual operations and `jq` for processing JSON responses. During development, I found that Who and What Object data cannot always be retrieved correctly by querying the type-specific collection endpoints directly. The reliable way to inspect the records is to use the `/objects` endpoint belonging to the relevant group.
The same detail matters when deleting records. Instead of deleting through paths such as `email/{id}` or `domain/{id}`, PMGSuite uses the actual object path, `/objects/{id}`. This makes the deletion logic consistent across email, domain, regex, IP, network, and other object types. What Object groups and their records can also be listed through the corresponding API endpoints.
The project is designed to run directly on a Proxmox Mail Gateway host. It requires the `pmgsh` command and `jq`. The normal command starts an interactive menu, while `--help`, `--version`, and `--no-color` provide the basic command-line options. Each run also creates a timestamped log file under `.pmg/logs/`, which makes it easier to review what happened during an operation.
I also included two language versions. `pmgg.sh` provides the Turkish interface, while `pmgs.sh` provides the English interface. Both scripts are intended to offer the same functionality and use the same PMG API approach.
PMGSuite is deliberately kept as a lightweight Bash tool. It does not require a database, a web server, or an additional application layer. This makes it easy to copy to a PMG host, inspect, customize, and use directly from an SSH session. At the same time, the interactive menus and confirmation steps make potentially destructive operations easier to review before they are executed.
I created PMGSuite to solve a practical problem in my own workflow: reducing repetitive PMG administration and making bulk operations less error-prone. It is a small project, but it gives me a reliable foundation for future improvements such as a web interface, scheduled reports, notification integrations, more advanced quarantine filters, and automated monitoring.
The source code is available on GitHub:
https://github.com/kronodes/PMGS
If you work with Proxmox Mail Gateway and frequently repeat similar command-line operations, PMGSuite can provide a more organized starting point for managing those tasks.