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

On Thu, 27 Mar 2014, Marcus Schopen wrote:

for some of my domains I'd like to reject mails at a given spamscore of
=5. For some other domains at a higher score. Is it a good idea to read
those domain names from different "external" config file instead of
coding them hard into mimedefang-milter?

sub filter_end {
[...]
 if (($Domain eq 'exmaple1.org' ||
      $Domain eq 'example2.org' ||
      $Domain eq 'example3.org') && $hits >= 5) {
        if ($WasResent) {
             action_discard();
        } else {
             action_bounce("Recipient refuses mail due to ...");
       }
 }

There are numerous ways:

a) DB_File, as Kris pointed out,
b) Storable
c) "require" an Perl-formatted file
d) CSV files and Text::CSV
e) plain text files
f) SQL backends
...

actually, I have all configuration stuff at the top the filter as hashes
or qr//s.

e.g. in your case

my %domainsDropHighSPAM = (
 'example.org' => 1,
 # ...
);

[...]

if(exists $domainsDropHighSPAM{lc $Domain}
 && $hits >= 5) {

- -or-

my $domainsDropHighSPAM = qr/\A(?:example\.org|example\.net|...)\z/i;
....
if($Domain =~ $domainsDropHighSPAM
 && $hits >= 5) {

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

iQEVAwUBUzUmgpSHNCne69JnAQJsawf/e0P0vviYHHexlK7Q6OxxXiXjFEGbspW8
E4lbG8/0eBEpcsLy6qgfPoyvpJ4a1zpMPrS0dC/jwGlZgjiJzJXix6myI7TOAueD
M7MApVfCrWdCiyUcYnlitGHiiFGlqk8RUw8kIkCKZcJknvdjHmxupF3flYeWRDmF
qKPu8vVGYnAhzMdyzkm36e2fEUWTAg3B111X+MdR5LvNllxPuRdQKD7wQ0QpkjSj
0ZvGOOypQHPbVeA6eCXsiy+OlmEZtZDJjKKbfwXjuTROIMnmHexcY5xuca+YHvQI
3nh5LBFlRTgH2ZsYNdhDJXZx5sDwiknKZxJkKnHLSoe/z9nU64N2Sw==
=+7bq
-----END PGP SIGNATURE-----
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to