[Mimedefang] How to count recipients in filter_recipient

kd6lvw at yahoo.com kd6lvw at yahoo.com
Tue Apr 16 14:32:27 EDT 2013

--- On Tue, 4/16/13, Dale Moore <Dale.moore at cs.cmu.edu> wrote:
> In this case, we merely main::delete_recipient($recipient_A); 
> then main::action_accept() for the rest of the recipients.
> You cant tempfail individual recipients once you peek at the message
> and see that it is spam.  By the time you see the message, you've already
> accepted the recipients.
> Different mimedefang-milter processes might handle the same message.
> One milter process could handle the relay while a different one handles
> the sender.  In fact, different processes could handle different recipients
> of the same message.  This makes persistent variables like $rcpt_count
> difficult to implement.

Look at how the Recipients array is defined during filter_recipient:

"[A]fter calling read_commands_file within filter_recipient, the current recipient under consideration is in the final position of the array, at $Recipients[-1], while any previous (and accepted) recipients are at the beginning of the array, that is, in @Recipients[0 .. $#Recipients-1]."

At the array lists only accepted recipients, one can easily reject or tempfail any future recipient that has a different spam policy than the first recipient (and only the first need be checked, since one checked for differences with the other elements as the array was built -- one recipient at a time).

More information about the MIMEDefang mailing list