[Mimedefang] Saving Headers for report

Steffen Kaiser skmimedefang at smail.inf.fh-bonn-rhein-sieg.de
Thu May 6 04:41:14 EDT 2004


On Thu, 6 May 2004, Jerome Tytgat wrote:

> Is there a possibility, with mimedefang, to automatically save
> only the headers (I don't want the full mail, as forwarding virus
> is not a good idea) to a folder using for name the reference number
> of the mail (also found in MDLOG entries) for easy linking.

I do it like so in filter_end():

my $logd = $Features{'Path:QUARANTINEDIR'} . "/maillog";
if(-d $logd) {
	my $logf = "$logd/${MsgID}-Report-" . localtime() . ".txt";
	if(open(LOG, ">$logf")) {
		print LOG $report;
		if(open(H, 'HEADERS')) {
			print LOG "\nHeaders:\n" . join('', <H>);
			close H;
		} else {
			print LOG "\nFailed to open headers: $!\n";
		}
		close LOG;
	} else {
			skalog "\nFailed to create logfile: $logf: $!\n";
	}
} else {
	skalog "No maillog dir: $logd";
}

Bye,

-- 
Steffen Kaiser



More information about the MIMEDefang mailing list