Table of Contents

Qmail

Setting up RBL for qmail

Add this code to qmail service startup file.

if [ -f /var/qmail/control/spamhaus ]; then
   rblsmtpd="/usr/local/bin/rblsmtpd -r sbl-xbl.spamhaus.org"
else
   rblsmtpd="/usr/local/bin/rblsmtpd -r cbl.abuseat.org -r dul.dnsbl.sorbs.net -r http.dnsbl.sorbs.net -r misc.dnsbl.sorbs.net -r smtp.dnsbl.s
orbs.net -r socks.dnsbl.sorbs.net \
      -r spam.dnsbl.sorbs.net -r web.dnsbl.sorbs.net -r zombie.dnsbl.sorbs.net"
fi

Block sender based .qmail (Bouncesaying)

Here is the quick work around to block sender / domain using .qmail for user OR domain.

To block sender :
| if [ "${SENDER}" = "ketan@xyz.com" ]; then /var/qmail/bin/bouncesaying 'RESTRICTED: Domain policy disallows sending email to our domain.'; fi;
To block Domain :

Blocking xyz.com to send email to ketan@pqr.com

| /var/qmail/bin/bouncesaying 'RESTRICTED: Domain policy disallows sending email to our domain.' sh -c 'echo $SENDER | grep -qi "@xyz.com$"'
To forward if outgoing match
|if [ "$SENDER" = "support@test.k2patel.in" ]; then /var/qmail/bin/forward fire@power.com; fi

NOTE : - This line must be appear first in file - when you restrict for user you must add user Maildir line after this line. e.g. “/usr/local/vpopmail/domains/9/W/pqr.com/info/Maildir/”