On 9/5/2017 7:15 AM, MAYER Hans wrote:
Dear mailing list members,
I am looking for a possibility to filter for an existing header line.
I found a lot of examples where $Subject, $Sender and others can be used.
But I need the possibility to find a certain header line, for example
X-Someinfo:
Can someone point me to some examples.
I was searching at Google but obviously with the wrong keywords.
Kind regards
Hans
Hi Hans,
Here's how I do it:
if (uc &check_header(header=>"X-HANS-Check-Header") eq
'X-HANS-CHECK-HEADER: TRUE') {
blah...
}
# check the HEADERS file and return any instances of a specific
parameter header (case insensitive on header name)
sub check_header {
my (%params) = @_;
my ($filehandle, $output);
$params{'header'} || return undef;
$filehandle = new IO::File('< ./HEADERS') or return undef;
while (<$filehandle>) {
if ($_ =~ /^$params{'header'}:/i) {
$output .= $_;
}
}
close ($filehandle);
return $output;
}
Regards,
KAM
_______________________________________________
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 [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang