Showing posts with label Postfix. Show all posts
Showing posts with label Postfix. Show all posts

Tuesday, 4 September 2012

Anti-Spam Email server

In this post I'll show you how to install an anti-spam smart host relay server, based on Ubuntu 12.04 LTS, that will include:

Postfix w/Bayesian Filtering and Anti-Backscatter (Relay Recipients via look-ahead), Apache2, Mysql, Dnsmasq, MailScanner (Spamassassin, ClamAV, Pyzor, Razor, DCC-Client), Baruwa, SPF Checks, FuzzyOcr, Sanesecurity Signatures, PostGrey, KAM, Scamnailer, FireHOL (Iptables Firewall) and Relay Recipients Script.

Continue reading for the instructions.

Possibly Related Posts

Saturday, 21 May 2011

Postfix Queue Management

Again some very useful one liners but this time to manage the Postfix mail queue.

Release messages from hold
mailq | awk '{if($1 ~ /[A-F0-9]+!$/) {gsub(/!/, "", $1); print($1); system(sprintf("postsuper -H%s", $1)); } }'
postqueue -f 
Requeue hold messages to force delivery
mailq | awk '{if($1 ~ /[A-F0-9]+!$/) {gsub(/!/, "", $1); print($1); system(sprintf("postsuper -H%s", $1)); } }' 
Flush the queue
postqueue -f
Clean all MAILER-DAEMON error messages 
Normal Messages
mailq | tail +2 | awk '{ if ($7 == "MAILER-DAEMON") print $1 } ' | postsuper -d -
for me mailq returns the message id with a trailing ! so I use:
mailq | awk '{ if ($7 == "MAILER-DAEMON") print substr ($1, 1, length($1)-1) } ' | postsuper -d -

Messages with errors
mailq | grep MAILER-DAEMON |  sed -e 's/!$//' | cut -d " " -f 1 | postsuper -d -
or
mailq | tail +2 | awk '{ if ($7 == "MAILER-DAEMON") print $1 } ' | sed -e 's/!$//' | postsuper -d -
If you want to delete messages with the ! sign on the end, use
mailq | tail +2 | awk '{ if ($7 == "MAILER-DAEMON") print $1 } ' | cut -d! -f 1 | postsuper -d -
NOTE: Sometimes, you may need to omit the:
tail +2

Possibly Related Posts

Reading message content on postfix queue

Get the id of the message by

mailq | grep "search something"

Then

postcat -q MESSAGE_ID 

Possibly Related Posts