Useful CLI commands for managing PowerMTA and auxiliary services

🔧 System
  • service pmta restart — restart PowerMTA
  • pmta reload — reload configuration without stopping the service
  • pmtahttp restart — restart PowerMTA web interface
  • service pmta start — start PowerMTA
  • pmtad --debug — debug mode for troubleshooting
  • pmta reset counters — reset statistics counters
  • pmta show status — check current service status
📤 Mailing
  • pmta pause queue domain.com/vmta — pause sending for a specific VMTA
  • pmta pause queue */* — pause all queues
  • pmta pause queue domain.com/* — pause by domain
  • pmta pause queue */vmta — pause by VMTA
  • pmta resume queue domain.com/vmta — resume for a specific VMTA
  • pmta resume queue */* — resume all queues
  • pmta resume queue domain.com/* — resume by domain
  • pmta set queue --mode=normal domain.com/vmta — disable backoff mode for VMTA
  • pmta set queue --mode=normal */* — disable backoff mode for all
  • pmta delete --queue=gmail.com/* — delete queue by domain
  • pmta delete --queue=*/vmta — delete queue by VMTA
  • pmta delete --queue=*/* — clear all queues
📊 Statistics
  • pmta list --queue=gmail.com — all queues for Gmail
  • pmta list --queue=*/* — all queues
  • pmta show queues — detailed queue information
  • pmta show disabled sources — list of all blocked IPs
  • pmta show disabled sources domain.com/* — blocks by domain
  • pmta show disabled sources */vmta — blocks by VMTA
  • pmta show domains — list of all recipient domains
  • pmta show topdomains — most active domains
  • pmta show topqueues — queues with highest load
  • pmta show vmtas — status of all VMTAs
⚙️ Domain Settings
  • pmta show settings domain — basic settings of all domains
  • pmta show settings gmail.com/* — settings of a specific domain
📁 Other
  • show version — PowerMTA version
  • pmta show registration — registration status
  • pmta show license — license information

🔧 System
  • systemctl restart postfix — restart Postfix service
  • systemctl start postfix — start Postfix service
  • systemctl stop postfix — stop Postfix service
  • systemctl status postfix — check service status
  • postfix reload — reload configuration without stopping the service
  • postfix check — check configuration for errors
  • postconf -n — show only modified settings
  • postconf -d — show all default parameters
📤 Mailing
  • sendmail user@example.com — send an email manually (body typed after execution)
  • mailq — list emails in the queue
  • postqueue -p — same as mailq
  • postqueue -f — immediately process the queue
  • postqueue -s domain.com — send messages only for the specified domain
🛠 Diagnostics & Logs
  • tail -f /var/log/mail.log — view mail log in real time
  • grep postfix /var/log/mail.log — filter log for Postfix entries
  • grep -i "status=" /var/log/mail.log — check email delivery statuses
  • postfix -v start — start Postfix in verbose/debug mode
📦 Queue Management
  • postsuper -d ALL — delete all messages in the queue
  • postsuper -d queue_id — delete a specific message
  • postsuper -r queue_id — requeue a specific message
  • postsuper -r ALL — requeue all messages
  • postsuper -s — check and clean up "dead" messages from the queue
⚙️ Other
  • newaliases — rebuild alias database (after editing /etc/aliases)
  • postalias /etc/aliases — alternative to newaliases
  • postmap /etc/postfix/filename — generate hash map from a config file
  • postfix set-permissions — set correct permissions (rarely used)
  • postfix upgrade-configuration — upgrade old configs to the new format

🔧 System
  • systemctl start dovecot — start the Dovecot service
  • systemctl stop dovecot — stop the Dovecot service
  • systemctl restart dovecot — restart Dovecot
  • systemctl reload dovecot — reload configuration without stopping
  • systemctl status dovecot — check Dovecot service status
  • doveconf — output the full Dovecot configuration
  • doveconf -n — output only non-default (customized) parameters
🛠 Diagnostics & Logs
  • tail -f /var/log/mail.log — view mail server logs in real time (usually includes Dovecot)
  • journalctl -u dovecot -f — view Dovecot logs via systemd in real time
  • doveadm log find — search for errors in Dovecot logs (requires doveadm logging enabled)
  • doveadm debug — start Dovecot in debug mode (for testing)
👤 User Management
  • doveadm user '*' — list all users
  • doveadm user user@example.com — show info for a specific user
  • doveadm mailbox list -u user@example.com — list mailboxes for the user
📨 Mail Operations
  • doveadm quota get -u user@example.com — show the user's quota
  • doveadm expunge -u user@example.com mailbox INBOX savedbefore 30days — delete emails older than 30 days from INBOX
  • doveadm fetch savedate mailbox INBOX all — show saved date of all emails in INBOX
⚙️ Other
  • doveadm auth test user@example.com password — test user authentication with a given password
  • doveadm ssl generate — generate an SSL certificate for Dovecot (if not using an external one)
  • doveadm config get — get values of specific configuration parameters

🔧 System
  • systemctl start fail2ban — Start Fail2ban
  • systemctl stop fail2ban — Stop Fail2ban
  • systemctl restart fail2ban — Restart Fail2ban
  • systemctl status fail2ban — Check Fail2ban status
🚫 Ban Management
  • fail2ban-client status — General Fail2ban status
  • fail2ban-client status <jail_name> — Status of a specific jail
  • fail2ban-client set <jail_name> banip <IP_address> — Manually ban an IP
  • fail2ban-client set <jail_name> unbanip <IP_address> — Unban an IP
  • fail2ban-client reload — Reload configuration
🕵️‍♂️ Diagnostics
  • journalctl -u fail2ban -f — View logs in real time
  • fail2ban-client ping — Check if the daemon is running

▶️ Start and Stop
  • systemctl start spamassassin — Start SpamAssassin
  • systemctl stop spamassassin — Stop SpamAssassin
  • systemctl restart spamassassin — Restart SpamAssassin
  • systemctl status spamassassin — Check service status
⬆️ Update and Check
  • sa-update — Update SpamAssassin rules
  • spamassassin -t < email.eml — Test an email for spam
  • spamc < email.eml — Quick spam test using client
🔍 Diagnostics and Configuration
  • spamassassin --lint — Check configuration for errors
  • spamassassin --dump-headers — Output all headers used for filtering
  • spamassassin --version — Show SpamAssassin version

🔧 System
  • systemctl start opendkim — Start OpenDKIM
  • systemctl stop opendkim — Stop OpenDKIM
  • systemctl restart opendkim — Restart OpenDKIM
  • systemctl status opendkim — Check service status
⚙️ Configuration
  • nano /etc/opendkim.conf — Main configuration file
  • nano /etc/opendkim/KeyTable — Key table
  • nano /etc/opendkim/SigningTable — Signing table (domains to sign)
  • nano /etc/opendkim/TrustedHosts — Trusted hosts
🛠️ Key Generation
  • opendkim-genkey -s mail -d example.com — Generate DKIM key
  • cat mail.txt — View DKIM DNS record
🕵️‍♂️ Diagnostics
  • journalctl -u opendkim -f — View logs in real time
  • opendkim-testkey -d example.com -s mail -vvv — Test DKIM key

📦 Installation
  • apt install apache2 — Install on Debian/Ubuntu
  • dnf install httpd — Install on AlmaLinux/CentOS/RHEL
🔧 Service Management
  • systemctl start apache2 — Start Apache (Debian)
  • systemctl start httpd — Start Apache (AlmaLinux)
  • systemctl restart apache2 — Restart (Debian)
  • systemctl restart httpd — Restart (AlmaLinux)
  • systemctl status apache2 — Status (Debian)
  • systemctl status httpd — Status (AlmaLinux)
🛠️ Configuration
  • /etc/apache2/apache2.conf — Main config (Debian)
  • /etc/httpd/conf/httpd.conf — Main config (AlmaLinux)
  • /etc/apache2/sites-available — Virtual hosts (Debian)
  • /etc/httpd/conf.d — Virtual hosts (AlmaLinux)
🚀 Site Management Commands (Debian only)
  • a2ensite site.conf — Enable a site
  • a2dissite site.conf — Disable a site
  • a2enmod rewrite — Enable a module
  • a2dismod rewrite — Disable a module
🧪 Testing and Restart
  • apachectl configtest — Test configuration
  • apachectl graceful — Graceful restart
  • journalctl -u apache2 -f — Real-time logs (Debian)
  • journalctl -u httpd -f — Real-time logs (AlmaLinux)