Postfix

# view mailqueue
mailq
 
# view email count in mailqueue
mailq | egrep '^--'
 
# delete single mail from queue
postsuper -d Queue_ID
 
# delete all mailqueues
postsuper -d ALL
 
# send waiting messages
postfix flush
 
# delete duplicate mail
mailq | awk 'BEGIN { RS = "" } / foo\.bar@example\.com$/ { print $1 }' | tail -1 | postsuper -d -
 
# statistic
apt-get install pflogsumm
pflogsumm --detail 0 /var/log/mail.log
 
# view spam
grep "policyd-weight.*action=" /var/log/mail.log | grep -v PREPEND | grep mike
 
# find mails bigger then 50mb
find /home/ -type f -size +50000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
 
# blacklists
http://zy0.de/q/YOUR_MAILSERVER_IP
http://www.dnsbl.info/dnsbl-database-check.php
 
# test
echo "USER: ${USER}" | mail -s "TEST from ${HOSTNAME}" mail@example.com
 
# configure postfix virtual alias table
vi /etc/postfix/virtual
postmap /etc/postfix/virtual
service postfix reload
 
# configure mail aliases
/etc/aliases
newaliases
service postfix reload
 
# Links
http://www.buildcube.com/tech_blog/2012/07/15/inspecting-postfixs-email-queue/
http://www.linuxlasse.net/linux/howtos/Blacklist_and_Whitelist_with_Postfix - Blacklist & Whitelist with Postfix
http://www.huschi.net/4_277_de-postfix-mail-queue-bearbeiten.html
http://zy0.de/
http://www.dnsbl.info/dnsbl-database-check.php
http://www.cyberciti.biz/faq/howto-blacklist-reject-sender-email-address/
 
# Spam list check / remova
https://www.rackaid.com/blog/spam-blacklist-removal/