[Mimedefang] conditionally add boilerplate in message with more than one recipient
Richard Laager
rlaager at wiktel.com
Wed Sep 21 10:42:24 EDT 2016
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 user at domain.org,
delete_recipient(user at domain.org), 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
More information about the MIMEDefang
mailing list