[Mimedefang] filter on header From:

Kris Deugau kdeugau at vianet.ca
Mon May 8 17:27:15 EDT 2017

Marcus Schopen wrote:
> Hi Kris,
> Am Montag, den 08.05.2017, 11:13 -0400 schrieb Kris Deugau:
>> if ($hashfile{$fromaddr}) {
>>    action_add_header("SpecialHeader", "$fromaddr found in list");
>> }
> Ah, good idea. Thanks!
> But if I just add this to filter_end
>   action_add_header("X-SpecialHeader", "$fromAddr test");
> to read out $fromAddr, the variable is empty in my case.

You would have to fill it in first, by extracting it from the 
MIME::Entity passed to the filter_end sub;  something like (untested, 
check MIME::Tools documentation):

$fromaddr = $entity->head->get('From');
$fromaddr =~ s/.+<([^>]+)>/$1/;

If you just want to test, you can try $Sender instead, which is the 
envelope sender.

See the man page for mimedefang-filter to see which globals are provided.


More information about the MIMEDefang mailing list