[Mimedefang] Deleting Multiple Headers

David F. Skoll dfs at roaringpenguin.com
Fri Oct 4 13:07:01 EDT 2002


On Fri, 4 Oct 2002, Schuster, Dan wrote:

> how many there are.  For instance, if there were four "X-Spam-Level:" in a
> header already I want to remove them all so that I could add my own.

> The only thing I could think of is having a return value for
> action_delete_header if it did remove something and then putting that
> function in a loop???

That doesn't work, because you can't get that information from the
milter API.

About the only way to do it is to open the HEADERS file, count the number
of headers, and then delete them all.  Something like:

	open(HDRS, "<HEADERS");
	$count = 0;
	while(<HDRS>) {
		$count++ if /^X-Spam-Level:/;
	}
	close(HDRS);
	for ($i=1; $i <= $count; $i++) {
		action_delete_header("X-Spam-Level", $i);
	}

--
David.




More information about the MIMEDefang mailing list