[Mimedefang] filter on header From:

Kris Deugau kdeugau at vianet.ca
Mon May 8 11:13:42 EDT 2017


Marcus Schopen wrote:
> Hei,
>
> I have a text base list of email addresses (one email per line). Where
> would I best filter on header "From: " (not envelope from) in
> mimedefang-filter and add an additional mail header in case of a hit? At
> the moment I use spamassassin rules to tag such mails in filter_end, but
> spamassassin catches only mails if their "./INPUTMSG" smaller than the
> global given message size, which I don't want to increase.

You should be able to use the MIME::Entity passed to filter_end to 
retrieve the From: header.

Unless it's fairly short, I'd recommend converting your text file into 
your favourite flavour of key-value hash table file, accessible from MD 
as a tied hash via the matching Perl *DB_File module.

Then it's just a matter of:

if ($hashfile{$fromaddr}) {
   action_add_header("SpecialHeader", "$fromaddr found in list");
}

-kgd



More information about the MIMEDefang mailing list