Re: conditionally add boilerplate in message with more than one recipient

Richard Laager <[email protected]>
Newsgroups gmane.mail.mimedefang
Message-ID <[email protected]>
On 09/21/2016 09:09 AM, Vieri Di Paola wrote:
>> You can stream_by_recipient() so MIMEDefang resends the message for each
>> recipient. In this way, your filter code can handle recipients
>> differently. Note the warnings in the mimedefang-filter man page, though.
> 
> The man page isn't too extensive on this. At a first glance it seems that calling stream_by_recipient in filter_begin does not trigger the code in filter_end, for instance. So if  stream_by_recipient is true then only filter() is run?

I don't use stream_by_recipient() and never have. Here's my
understanding, though... If stream_by_recipient() returns false, there
was only one user, so stream_by_recipient() did nothing and the filter
runs as normal. If there are multiple recipients, then
stream_by_recipient() resends the original message to each recipient
individually, and your filter should terminate. You'll then see the new
messages in separate invocations of your filter.

>> Alternatively, you can do all the work yourself, and only selectively
>> resend when necessary. This is what I do (not for boilerplate insertion,
>> but other things).
> 
> How do you do that?
> Do you use resend_message()? (but that resends immediately the ORIGINAL message)

Until a few weeks ago, yes. We were adding a header in some cases. So
what we did was: if everyone wants the header, add it, and we're done.
If some recipients want the header and some don't, resend the (original)
message to those who *don't*, remove them with delete_recipient(), and
add the header.

So in your case, you would resent to [email protected],
delete_recipient([email protected]), and then add the boilerplate.

We're now doing more extensive modifications, so I have re-implemented
resend_message() with my own code to modify the message as appropriate.

-- 
Richard
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.