[Mimedefang] redirect spam for a single domain to another recipient

Steffen Kaiser skmimedefang at smail.inf.fh-bonn-rhein-sieg.de
Thu Apr 3 02:10:41 EDT 2014


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

On Wed, 2 Apr 2014, Marcus Schopen wrote:

> I use stream_by_domain and like to redirect/move spam for a single
> domain to a special recipient/mailbox and collect it there. Any better
> code possible?
>
> sub filter_end {
> [...]
>            if ($Domain eq 'mydomain.de' && $hits >= 5) {
>                 foreach $recip (@Recipients) {
>                     delete_recipient($recip);
>                 }
>                 add_recipient('spambox');
>            }

Looks good for me. About "$Domain": I'm not sure, whether or not the 
domain is always lower-case and never has a dot at the end, therefore I 
always lower-case domains names and accept an additional final dot, e.g.:

$Domain =~ /\Amydomain\.de\.?\z/i

Cosmetic: foreach my $recip ...
or delete_recipient($_) for @Recipients;

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEVAwUBUzz7YZSHNCne69JnAQKUXwf/fLhwChGWGTdSRgZqBRkPth5tCp8ldp89
HE1UbzONAfFDGCjABDl4EE/+erFHjfeyPzhaRlH9dh+NoNLwByD8+d3Wdadm8wVA
QlfkAirk6yHrp1njrs5fTOuf+TIL0AuX/oQGhYtza2O6Q92tHUnF97CdWM+op26c
4tLGNiMxLFzA85MIE1MdkxLc0OljWEIrK2WslYwYermMRbMiW61SAYdvOPlkJEio
3lGwML0Ey/oglAHQP8jsUZGVtoL9+e0Mh18NeeeJdSmbGtEFgduhXvUj4Zx0UGkg
KkHxI76N7SUY53Pba3/S3V7xrnVefcqBAK8UnCLzQQqskEbrB6/TPw==
=NEiN
-----END PGP SIGNATURE-----



More information about the MIMEDefang mailing list