On 12/1/2020 1:10 PM, Joseph Brennan wrote:
We used this to create an array of header information:
if (open(IN, '<', './HEADERS')) {
while(<IN>) {
chomp;
if (/^(\S+):\s*(.*)/) {
my $label = $1;
my $data = $2;
$label = lc($label);
$Header{$label} = $data;
if ($label eq 'received') {
push(@Received,$data);
}
}
close(IN);
}
So following this, if for example we want to test the From: header, we
check $Header{'from'}
Received: was handled specially. It could end up an empty list. I
don't think we checked for that!
Hmm... If HEADERS was not there (??) it fails silently and
$Header{'anything'} is empty. The rest of filter still works,
but maybe we should have logged that case.
Does using MIME::Tools and $entity->head->get('Received'), for example,
work? Not sure how it parses through the various received headers.
For example, I convert Date's to unix epoch time format with something
like this and the Date::Parse module:
$date_unixtime = Date::Parse::str2time($entity->head->get('Date'));
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 MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang