Hi Kris, Am Dienstag, den 09.05.2017, 10:51 +0200 schrieb Marcus Schopen: > Is there a way to load the key-value hash table file only at > start/reread/reload of mimedefang and not read it on each incoming email > in filter_end?
Haha, we had a similar discussion three years a ago ;) http://lists.roaringpenguin.com/pipermail/mimedefang/2014-March/037274.html This is my mimedefang-filter now: sub filter_initialize { require DB_File; use Fcntl; tie %testhash_list, "DB_File", "/etc/mail/testhash.db", O_RDONLY; } sub filter_cleanup { untie %testhash_list; } sub filter_end { [...] # get header From and compare to hash my $fromaddr = $entity->head->get('From'); $fromaddr =~ s/.+<([^>]+)>/$1/; $fromaddr =~ s/\s+$//; if(exists $testhash_list{lc $fromaddr}) { action_add_header("X-SpecialHeader", "$fromaddr is in testhast_list"); } The hash file is created with makemap hash testhash.db < testhash.txt The format of the hash file is just myemailaddr...@domain.de<TAB>1 What I don't understand is, why there is an ending white space on the header From variable $fromaddr, so I have to trim it with $fromaddr =~ s/\s+$//; Ciao Marcus _______________________________________________ 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