PMGS and PMGG are interactive management tools for Proxmox Mail Gateway (PMG). Both scripts provide the same operations; pmgg.sh uses Turkish prompts and pmgs.sh uses English prompts. They combine bulk Who Object management, quarantine delivery, allowlist/blocklist administration, Postfix queue operations, Who regex/IP/network management, and What Object listing in one Bash script.
- A Proxmox Mail Gateway host with the
pmgshCLI available. - Bash.
jqfor JSON parsing.- Permission to perform the requested PMG operations.
Place the desired script on the PMG host and make it executable:
chmod +x pmgg.sh
# or: chmod +x pmgs.shThe script does not install packages or change PMG configuration until an operation is selected and confirmed. Install jq when required:
apt install jq./pmgg.sh
./pmgg.sh --help
./pmgg.sh --version
./pmgg.sh --no-colorThe CLI flags are:
--help,-h: Show help and exit.--version,-v: Show the version and exit.--no-color: Disable colored terminal output.
Unknown options return an error. The normal command starts the interactive menu.
- Who Object bulk add: Add email addresses and domains in automatic, email-only, or domain-only mode. Existing records are skipped.
- Quarantine bulk delivery: Filter spam quarantine messages by sender, recipient domain, and optional dates. Dry-run mode lists matches without delivering them.
- Who Object bulk delete: Delete selected email or domain records, or confirm deletion of every record in a Who Object.
- Allowlist / Blocklist management: List, add, or delete email, domain, regex, IP, and CIDR records.
- Postfix queue management: List queues, delete queue IDs, flush selected messages, clear a queue, or flush all queues.
- Who Object regex / IP / network management: Add or delete regex, IP, and CIDR records.
- What Object listing: List What groups and the records contained in each group.
The main menu also provides L to display the newest log and H to display help. Use 0 to exit.
The script uses pmgsh and jq rather than calling the PMG database directly.
- Who groups are discovered with
/config/ruledb/who. - Who group configuration is read from
/config/ruledb/who/<group-id>/configbecause the group listing contains IDs. - Who records are read from
/config/ruledb/who/<group-id>/objects. - Who record deletion uses
/config/ruledb/who/<group-id>/objects/<object-id>, ensuring the actual record ID is deleted. - What groups are discovered with
/config/ruledb/what, then their configuration and records are read from/config/ruledb/what/<group-id>/configand/config/ruledb/what/<group-id>/objects. - Allowlist and blocklist records use their respective
/config/<list>/<type>endpoints. - Quarantine delivery uses
/quarantine/content --id <id> --action deliver. - Postfix queue operations use
/nodes/<node>/postfix/...endpoints.
Responses are checked for errors and HTTP-style status 4xx or 5xx text. JSON error details are extracted with jq when available in the response.
Each run creates a timestamped log in:
.pmg/logs/pmgg-YYYYMMDD-HHMMSS.log
The directory is relative to the script location. Informational, success, warning, and error messages are written to the log. The L menu option displays the newest log file.
- Review the selected records before bulk operations.
- Use quarantine dry-run mode before real delivery.
- Delete-all and queue-clearing operations require an explicit
yesconfirmation. - Run the script with an account that has only the PMG permissions required for the task.
- Keep logs protected because they can contain object values, queue IDs, addresses, and operation results.
- Test destructive actions on a small set before applying them broadly.
- The script is intended for PMG hosts and requires a working
pmgshconnection.
Start the normal interactive menu:
./pmgg.shShow help without connecting to PMG:
./pmgg.sh --helpRun in a non-color environment:
./pmgg.sh --no-colorDisplay the installed script version:
./pmgg.sh --version