[Mimedefang] HTML ok?

Jan Pieter Cornet johnpc at xs4all.nl
Thu Sep 9 05:58:34 EDT 2004


On Wed, Sep 08, 2004 at 08:29:02PM -0600, Ashley M. Kirchner wrote:
> 
>    This got lost a while back, so I'm posting again.  We have a few 
> e-mails we'd like to come through as-is, in HTML format.  Right now, the 
> current filter will strip/defang the message, as it does all of them 
> (and we're happy with it,) but we'd like to be able to bypass this 
> mechanism for specific messages (or senders.)  What's the easiest, or 
> best way to do this?

Well, that depends on what you want, exactly. Do you want to base it on
certain messages, or on certain senders? :) And if so, how many?

Anyway, the fix is to somehow make the call to
"remove_redundant_html_parts", that is currently in your sub filter_end,
optional.

Something along the lines of:

    unless ( user_allowed_to_send_html($Sender) 
	or html_allowed_in_message($entity) )
    {
	remove_redundant_html_parts($entity);
    }
    ...


# returns true if user allowed to send html unfiltered
sub user_allowed_to_send_html {
    my $user = shift;

    if ( $user =~ /^<?grandma at hotmail.com>?$/i ) {
	return 1;
    }
    # use a hash lookup if you need to match against lots of users.
    return 0;
}

# returns true if html message is allowed to pass unfiltered
sub html_allowed_in_message {
    my $entity = shift;

    my $body = $entity->bodyhandle->as_string; # XXX: not necessarily efficient!
    if ( $body =~ m/webmaster trick of the day/ ) {
	return 1;
    }
    return 0;
}

-- 
#!perl -wpl # mmfppfmpmmpp mmpffm <pmmppfmfpppppfmmmf at fpffmm4mmmpmfpmf.ppppmf>
$p=3-2*/[^\W\dmpf_]/i;s.[a-z]{$p}.vec($f=join('',$p-1?chr(sub{$_[0]*9+$_[1]*3+
$_[2]}->(map{/p|f/i+/f/i}split//,$&)+97):qw(m p f)[map{((ord$&)%32-1)/$_%3}(9,
3,1)]),5,1)='`'lt$&;$f.eig;                                # Jan-Pieter Cornet



More information about the MIMEDefang mailing list