[Mimedefang] stream_by_recipient() and Postfix

Nathan Findley nathan at zenlok.com
Sat Sep 15 02:09:16 EDT 2012


On 09/15/2012 06:29 AM, Philip Prindeville wrote:
>
>> As per the mimedefang-filter man page:
>>
>>        This  function  should  only  be called at the very beginning of
>>        filter_begin(), like this:
> which no one seemed to dispute, so I took that to mean that it was safe, if somewhat inadvisable, to call stream_by_recipient() from filter_end().
>
> The documentation of stream_by_recipient() is a little thin, in particular the return value, and whether one needs to call action_discard() to avoid duplicate delivery, or if it takes care of that for you (which would seem not to be the case, at least in my usage).
>
> -Philip
>
It if makes you feel any better, I have been calling it from filter_end 
for quite some time now. And, yes, I wrap the method with an if 
statement that then discards the mail. This is also something I use for 
required logic earlier in my filtering:

#***********************************************************************
# %PROCEDURE: will_stream_by_recipient
# %ARGUMENTS:
# %RETURNS:
# True when streaming will take place
# %DESCRIPTION:
# Determines whether or not this message will be streamed.
#***********************************************************************
sub will_stream_by_recipient() {
return 0 if (!in_message_context("stream_by_recipient"));
if ($#Recipients <= 0) {
# Only one recipient (or none??)
return 0;
}
return 1;
}

Regards,
Nate

-- 
システムマネージャー/開発責任者
Zenlok株式会社




More information about the MIMEDefang mailing list