-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tim Meadowcroft writes:
> I've noticed that a fair proportion of what gets thru my filters (and just 
> about the only spam that gets past the gmail spam filters on my account so 
> far) is foreign language encoded spam.
> 
> I suppose this isn't hitting all the SpamAssassin hand-made keywords or the 
> Bayesian filters, and while I'm no SA expert I couldn't see a simple config 
> to turn it on

"ok_languages" is what you're after ;)

- --j.

> , so I wrote the following reject_languages plugin to look for 
> subject lines with initial language specifiers (start with "=?LANG?" such as 
> the following denoting Russian: "=?koi8-r?B?78LdxdPU188g08/DycHM2M7....").
> 
> For the moment I'm only changing the subject line and filtering on that, but 
> it seems to work so far - I realise rejecting anything in certain languages 
> might seem a little extreme but is anyone else seeing a load of Korean, 
> Japanese and Russian spam, and how are you dealing with it ?
> 
> Cheers
> 
> --
> Tim
> 
> #!/usr/bin/perl -w
> #
> # Reject (or mark) mail where the subject, sender or recipient headers
> # are marked up in "known spammy" languages.
> # reject_languages koi8-r ks_c_5601-1987
> 
> sub register {
>     my( $self, $qp, @args ) = @_;
>     $self->register_hook('data_post', 'checkForBadLanguages');
> 
>     # reject specified bad languages, or take these as the common offenders
>     my @badlang = @args ? @args : qw(koi8-r ks_c_5601-1987 ISO-2022-JP);
>     $self->{_rejectlanguages} = { map( (lc($_) => 1), @badlang ) };
> }
> 
> sub checkForBadLanguages {
>     my ($self, $transaction) = @_;
>     my @hdrsToCheck = qw(Subject From To);
> 
>     my $subject = $transaction->header->get('Subject') || '';
>     foreach (map($transaction->header->get($_), @hdrsToCheck))
>     {
>         my $language = lc($1) if /^=\?(.*?)\?/;
> 
>         # return (DENY, "You what ?")
>         #    if $self->{_rejectlanguages}->{$language};
> 
>         $transaction->header->replace('Subject', "***FOREIGN *** $subject")
>             if $self->{_rejectlanguages}->{$language};
>     }
> 
>     return DECLINED;
> }
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Exmh CVS

iD8DBQFCWtj5MJF5cimLx9ARArCGAJsGDuHsREyAWIlQaQ4t+0sPiO1Y4wCfYrKg
G+kplrJKmD2CNYT/A+1y82g=
=K3pT
-----END PGP SIGNATURE-----

Reply via email to