[Mimedefang] conditionally add boilerplate in message with more than one recipient

Vieri Di Paola vieridipaola at gmx.com
Wed Sep 21 18:13:46 EDT 2016


> From: "Richard Laager" <rlaager at wiktel.com>
> So in your case, you would resent to user at domain.org,
> delete_recipient(user at domain.org), and then add the boilerplate.

It's a typo, I presume? In my example, user at domain.com wants the boilerplate and user at domain.org doesn't. So I guess you meant "resend to user at domain.com, delete_recipient(user at domain.org) and add boilerplate", right?

The man page says to call this function (resend_message) in either filter_begin() or filter_end(). The *boilerplate* functions can only be called in filter_end().
I haven't tried it yet but would it look something like this pseudo-code below?

sub filter_end() {
  @want_boilerplate = get_recipients_with_boilerplate_from(@Recipients);
  @dont_want_boilerplate = get_recipients_without_boilerplate_from(@Recipients);
  if (scalar(@dont_want_boilerplate) > 0 && resend_message(@want_boilerplate)) {
    foreach $recip (@dont_want_boilerplate) {
      delete_recipient($recip);
    }
    append_text_boilerplate();
    append_html_boilerplate();
  }
  [continue with other filtering code in this function...]

Sorry if I only have a vague idea of how the mimedefang filtering process works but I don't know if the new ORIGINAL message created by resend_message will also go through the filter_begin(), filter() and filter_end() functions again. That's because I have other filtering needs in those functions not just appending a boilerplate (such as virus scanning, etc). In other words, I need ALL messages to be processed via all filter*() functions and SOME messages sent to specific recipients should not have a boilerplate appended. So does the filtering process start over again with resend_message()?

Finally, I'm using Postfix 3.1.0 with mimedefang and it's working fine. However, I'm concerned that resend_message() might not work as expected since the man page only refers to Sendmail-specific flags.

Thanks,

Vieri




More information about the MIMEDefang mailing list