[Mimedefang] questions about filter parsing, message mod'ing, and bouncing messages

TLD MimeDefang tld.mimed at stimulacra.com
Mon Aug 31 11:01:26 EDT 2009


I have a few questions regarding the filtering process and also
about bouncing messages.

First, if filter() is called on a message, is it possible that
filter_multipart() will also be called?   The reason I ask is
this:

I have moved the spamassassin checking into the filter() and
filter_multipart() sections, in order to action_bounce() messages
with a high enough score.  It works well, but I've noticed in
the log files that sometimes the message header additions for
spamassassin are added twice.  It's not a problem, but it just
seems like it's doing extra work that it might not need to.
Which leads me to:

Second, can I move the spamassassin checks to filter_begin()? I
wasn't certain how much processing had been done on the message
between filter_begin() and filter(), so I didn't know if begin()
would accept the spamassassin called.  This would be the ideal
place, in my mind, to put it...

Next, I have a number of rules in the different filter subs that
cause message rejection/bounces.  I found quickly that the message
for action_bounce() must be fairly short.  What I really want to
do is to include more information in the bounced message, so that
legitimate users can see why the message was rejected.

I've seen this in bounced messages I've sent to other systems
where the message body says something about why the message was
rejected and gives url's and that kind of thing, this is what
I'm after.

So, I figured I could use the action_notify_sender() to do this,
but the way I have it running isn't working.  Meaning, the sender
is not receiving anything on bounced messages, except for the
original bounced message.

Here's the bounce segment for that (in filter() and also in
filter_multipart() - can this also go in filter_begin()?):

---------------------------
   if(has_spam_markers($entity)) {
     $NotifySenderSubject = 'SPAM markers found';
     $NotifyNoPreamble    = 1;
     action_notify_sender(get_spam_markers_message());
     action_bounce('SPAM markers found');
     return action_discard();
   }
--------------------------

As I said, it does bounce the message as expected, but the
action_notify_sender isn't working (I've verified that
both functions has_spam_markers() and get_spam_markers_message()
are working as expected).



TLD/Brad




More information about the MIMEDefang mailing list