Are you getting ever more unsolicited emails (AKA spam or UBE)? Are you marred that the *nix guys have a slew of good tools to filter out UBE while there does not seem to be anything available for the average Joe that uses a Windows™-based system to download his or her mails via POP3 from the ISP's server? Well, here is a solution to help you keep your Inbox clean. Best of all, it's FREE. Everything you need to know is right on this page.
#!load hamster.hsm
###################################################################################
# Script : rblcheck.hsc #
# Description: Check incoming mails against an RBL to filter out spam #
# Maintainer : Rolf Leggewie #
# URL : http://leggewie.biz/hamster.htm #
# Version : 2002-10-07 #
# Thanx2 : Thomas G. Liesner for mail.getheader #
# Joern Weber for making the header changes permanent #
# Disclaimer : use at your own risk - be sure to know what you are doing #
###################################################################################
var ( $FileName, $HeaderList, $line, $IP, $octet1, $octet2, $octet3, $octet4, $RE_MyHosts )
varset ( $i, 0 ) # counter
# The hosts you receive mail at in RegExp notation (i.e. "mail\.domain\.tld|mail.domain2\.tld")
# Can be left blank as is. Then the IPs in all Received-Headers will be tested.
$RE_MyHosts = ""
$FileName = paramstr(2)
$HeaderList = ListAlloc
ListLoad ( $HeaderList, $FileName )
while( $i < ListCount($HeaderList) )
$line = ListGet( $HeaderList,$i )
# Header unfolding
if ( RE_Match( ListGet( $HeaderList,$i+1 ), "^(\t|\s)" ) )
$line = $line + ListGet( $HeaderList,$i+1 )
inc( $i )
if ( RE_Match( ListGet( $HeaderList,$i+1 ), "^(\t|\s)" ) )
$line = $line + ListGet( $HeaderList,$i+1 )
inc( $i )
endif
endif
# extract IP by octects, check RBL
RE_parse ($line, "^Received:.+from.+\b(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\b.+by.+" + _
$RE_MyHosts, $octet1, $octet2, $octet3, $octet4 )
if ( !( $octet1 = "" || $octet2 = "" || $octet3 = "" || $octet4 = "" ) )
if ( int($octet1) < 256 && int($octet2) < 256 && int($octet3) < 256 && int($octet4) < 256 )
RBL_Check ("relays.ordb.org") # check mails against ordb.org
# RBL_Check ("relays.osirusoft.com") # uncomment this line to also check against osirusoft.com
# RBL_Check ("put.another.rbl.here") # uncomment this line to also check against some other RBL
endif
endif
inc( $i )
endwhile
ListFree( $HeaderList )
quit
sub RBL_Check ( $RBL )
var ( $RBL_result )
$RBL_result = lookuphostaddr ( $octet4 + "." + $octet3 + "." + $octet2 + "." + $octet1 + "." + $RBL )
if ( RE_Match( $RBL_result, "^127\.0\.0\." ) )
if ( $RBL = "relays.osirusoft.com" )
$RBL_result = $RBL_result + icase ( $RBL_result, _
"127.0.0.2", " (open relay)", _
"127.0.0.3", " (DynIP)", _
"127.0.0.4", " (Confirmed Spam Source)", _
"127.0.0.6", " (Spamware)", _
"127.0.0.7", " (unconfirmed opt-in)", _
"127.0.0.8", " (formmail.pl)", _
"127.0.0.9", " (open proxy)", _
else, "" )
endif
ListAdd ( $HeaderList, "X-RBL-Warning: " + $RBL + " returned " + $RBL_result + _
" for " + $octet1 + "." + $octet2 + "." + $octet3 + "." + $octet4 )
ListSave ( $HeaderList, $FileName )
endif
endsub
Save the script and close the script window.Just to give you a general idea of how powerful and flexible this filtering method is.
Please drop me a line at hamster(a)rolf.leggewie.biz if you use the script. I appreciate it.
sponsored by: オリジナルtシャツ
![]()