[Mimedefang] Access to email Headers in mimedefang-filter?

Antonello Nocchi anto at cerca.com
Wed Apr 2 11:41:01 EST 2003


Mark Wiater wrote:
> 
> ..
>
> If the above is correct, how can I get that data, within the confines of
> mimedefang-filter? David, have you ever thought about a %Headers hash (there
> have been other times that I would have liked to know what was in the
> headers)?
> 

Mark, try to use something like this,
Bye

-------
..

use IO::File;

use vars     qw(
		%hHDRVARS
);

..
%hHDRVARS = ();
..

sub setHeadersVars
{
	%hHDRVARS = ();
	my $headers = IO::File->new("<HEADERS");
	while ($_ = $headers->getline)
	{	#no CRNL
		s/[\n\r]+//g;
		if(/^([^:]+)[:]\s*(.*)$/)
		{	next if(lc($1) eq 'received');
			#$hHDRVARS{$1} = defined $2 ? StrTrim($2) : '';
			$hHDRVARS{$1} = $2 if(defined $2);
		}
	}
	$headers->close();
}

sub filter_begin()
{
	....
	setHeadersVars();
	...
}



--
Antonello Nocchi                        CERCA.COM S.r.l



More information about the MIMEDefang mailing list