[Mimedefang] which charset is being used in a mail?

David F. Skoll dfs at roaringpenguin.com
Mon May 13 09:02:41 EDT 2002


On Mon, 13 May 2002 Karel.DeBruyne at ua.ac.be wrote:

> Is there a way to find out the charset of the first (and often only) part
> in filter_begin ?

Yes, if you use the MIME::Tools functions.  It's a bit messy, so I will
not demonstrate how. :-)

But why do you need it in filter_begin?  You could do it like this:

sub filter_begin {
	$FirstPass = 1;
}

sub filter {
	# ...
	if ($FirstPass) {
		# Do something with charset
	}
	$FirstPass = 0;
}

sub filter_end {
	# Decide something based on charset?
}

Remember, by the time mimedefang.pl is invoked, almost all of milter
has happened and sendmail is just waiting for the return from
smfi_eom.  So you gain virtually no performance benefits by trying
to cram everything into filter_begin.  If you organize the rest
of your filter carefully, you can skip unnecessary processing once
a discard or bounce decision has been taken.

Regards,

David.




More information about the MIMEDefang mailing list