↑ ↓ select, Enter open, Esc close

Mail

Mail server diagnostics: manage the Postfix queue, find delivery problems, test SMTP and find out who is sending spam through the server.

15 one-liners: 10 harmless, 2 caution, 3 destructive

All Mail one-liners

Delete a single message from the Postfix queue

#postsuper -d 4F2A31C0E12
destructive

Delete all deferred mail from the Postfix queue

#postsuper -d ALL deferred
destructive

Delete all mail from one sender in the Postfix queue

#postqueue -p | awk -v s="info@example.com" '/^[0-9A-Za-z]/ && $7 == s {print $1}' | tr -d '*!' | postsuper -d -
destructive

Find a hacked mail account by its SMTP logins

#grep -o "sasl_username=[^ ,]*" /var/log/maillog | sort | uniq -c | sort -rn | head -20
harmless

Find permanently rejected emails in the mail log

#grep "status=bounced" /var/log/maillog | tail -n 20
harmless

Find the top senders in the Postfix queue

$postqueue -p | awk '/^[0-9A-Za-z]/ {print $7}' | sort | uniq -c | sort -rn | head -20
harmless

For the websites on your server

Free SEO and PageSpeed check

GENLOC.SEO analyzes any domain for load time, Core Web Vitals and on-page issues and tells you in plain words what is going on. Available in 11 languages.

by GENLOC.NETWORK, the team behind myline.de

Flush the Postfix queue and retry delivery now

$postqueue -f
caution

Regenerate the mail configuration in Plesk (mchk)

#plesk sbin mchk --with-spam
caution

Send a test email from the command line

$printf "Subject: Testmail von %s\n\nTest\n" "$(hostname -f)" | sendmail admin@example.com
harmless

Show mail users currently logged in to Dovecot

#doveadm who
harmless

Show the Postfix mail queue

$postqueue -p
harmless

Test an SMTP connection with STARTTLS and certificate

$openssl s_client -connect mail.example.com:587 -starttls smtp -servername mail.example.com
harmless

Trace delivery for an email address in the mail log

#grep -i "info@example.com" /var/log/maillog | tail -n 50
harmless

Trace local PHP mail sending to a system user

#grep "postfix/pickup" /var/log/maillog | grep -o "uid=[0-9]*" | sort | uniq -c | sort -rn | head -10
harmless

View the content of a message in the Postfix queue

#postcat -q 4F2A31C0E12
harmless

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.