Postfix invoking content filter for each recipient

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Postfix invoking content filter for each recipient

Arshad Khan
Hello

I have been using Postfix 2.6.6 on CentOS 6 which I have configured
with an 'After-queue content filter'. The filter gets invoked when an
email is received by Postfix. The content filter does some processing
and pass on the message to another server from where the message is
sent to the recipients.

Recently I built version 2.11.11 and configured it to use the same
content filter. However, now Postfix is invoking the content filter
for each of the recipient. I would like it to invoke the filter once
per message and not per recipient. What configuration setting should I
alter to get the desired behaviour?

Thanks in advance
Arshad
Reply | Threaded
Open this post in threaded view
|

Re: Postfix invoking content filter for each recipient

Wietse Venema
Arshad Khan:

> Hello
>
> I have been using Postfix 2.6.6 on CentOS 6 which I have configured
> with an 'After-queue content filter'. The filter gets invoked when an
> email is received by Postfix. The content filter does some processing
> and pass on the message to another server from where the message is
> sent to the recipients.
>
> Recently I built version 2.11.11 and configured it to use the same
> content filter. However, now Postfix is invoking the content filter
> for each of the recipient. I would like it to invoke the filter once
> per message and not per recipient. What configuration setting should I
> alter to get the desired behaviour?

What settings did you change from Postfix 2.6.6 to 2.11.11?
Try starting with the old configuration instead of building a
new configuration from scratch and missing something.

Look for *_destination_recipient_limit settings. With a value of
1, there is one delivery per recipient.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Postfix invoking content filter for each recipient

Arshad Khan
Hello
Thanks for a quick reply.

I will try the way you suggested. I did try changing the
*_destination_recipeint_limit to 1 but it still invoked the script the
same number of times as number of recipients.

Thanks
Arshad
On Thu, Aug 30, 2018 at 7:41 PM Wietse Venema <[hidden email]> wrote:

>
> Arshad Khan:
> > Hello
> >
> > I have been using Postfix 2.6.6 on CentOS 6 which I have configured
> > with an 'After-queue content filter'. The filter gets invoked when an
> > email is received by Postfix. The content filter does some processing
> > and pass on the message to another server from where the message is
> > sent to the recipients.
> >
> > Recently I built version 2.11.11 and configured it to use the same
> > content filter. However, now Postfix is invoking the content filter
> > for each of the recipient. I would like it to invoke the filter once
> > per message and not per recipient. What configuration setting should I
> > alter to get the desired behaviour?
>
> What settings did you change from Postfix 2.6.6 to 2.11.11?
> Try starting with the old configuration instead of building a
> new configuration from scratch and missing something.
>
> Look for *_destination_recipient_limit settings. With a value of
> 1, there is one delivery per recipient.
>
>         Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Postfix invoking content filter for each recipient

Matus UHLAR - fantomas
>> Arshad Khan:
>> > I have been using Postfix 2.6.6 on CentOS 6 which I have configured
>> > with an 'After-queue content filter'. The filter gets invoked when an
>> > email is received by Postfix. The content filter does some processing
>> > and pass on the message to another server from where the message is
>> > sent to the recipients.
>> >
>> > Recently I built version 2.11.11 and configured it to use the same
>> > content filter. However, now Postfix is invoking the content filter
>> > for each of the recipient. I would like it to invoke the filter once
>> > per message and not per recipient. What configuration setting should I
>> > alter to get the desired behaviour?

>On Thu, Aug 30, 2018 at 7:41 PM Wietse Venema <[hidden email]> wrote:
>> What settings did you change from Postfix 2.6.6 to 2.11.11?
>> Try starting with the old configuration instead of building a
>> new configuration from scratch and missing something.

Arshad you should try to follow this advice.

>> Look for *_destination_recipient_limit settings. With a value of
>> 1, there is one delivery per recipient.

On 30.08.18 19:51, Arshad Khan wrote:
>I will try the way you suggested. I did try changing the
>*_destination_recipeint_limit to 1 but it still invoked the script the
>same number of times as number of recipients.

you have misunderstood. Of course it it when *_destination_recipient_limit
is 1. It would apparently be different if it were not 1.


--
Matus UHLAR - fantomas, [hidden email] ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
I just got lost in thought. It was unfamiliar territory.
Reply | Threaded
Open this post in threaded view
|

Re: Postfix invoking content filter for each recipient

Wietse Venema
In reply to this post by Arshad Khan
Arshad Khan:
> Hello
> Thanks for a quick reply.
>
> I will try the way you suggested. I did try changing the
> *_destination_recipeint_limit to 1

With that setting Postfix makes one delivery per recipient.
Is that what you want?

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Postfix invoking content filter for each recipient

Viktor Dukhovni
In reply to this post by Arshad Khan


> On Aug 30, 2018, at 7:27 AM, Arshad Khan <[hidden email]> wrote:
>
> I have been using Postfix 2.6.6 on CentOS 6 which I have configured
> with an 'After-queue content filter'. The filter gets invoked when an
> email is received by Postfix. The content filter does some processing
> and pass on the message to another server from where the message is
> sent to the recipients.
>
> Recently I built version 2.11.11 and configured it to use the same
> content filter. However, now Postfix is invoking the content filter
> for each of the recipient. I would like it to invoke the filter once
> per message and not per recipient. What configuration setting should I
> alter to get the desired behaviour?

This is anecdotal retelling of your situation, with none of the supporting
evidence.  For useful help you need to post configuration information and
relevant logs.

For example, how is the content filter specified?  Is it just the transport
name or "transport:nexthop", ...  But instead of teasing out configuration
settings one by one with follow-up messages, see:

        http://www.postfix.org/DEBUG_README.html#mail

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: Postfix invoking content filter for each recipient

Arshad Khan
Hi All

Apologies for not being clear in my earlier message.

What I want is for the content filter to be invoked once per message and not per recipient. I tried setting various values for *_destination_recipient_limit (including 1) to get the desired behavior. But no matter what value I set, Postfix still invokes the filter for each recipient. Here are the settings for filter in master.cf:

192.168.1.10:10025  inet    n   -   n   -   -   smtpd
    -o content_filter=my_filter

my_filter    unix    -   n   n   -   -   pipe
    flags=Rq user=testuser argv=/usr/local/bin/my_filter.py -f ${sender} ${client_address} -- ${recipient}

Settings in main.cf that I have overridden:


smtpd_client_restrictions =
    permit_mynetworks,
    reject_unauth_destination,
    permit

Values for *_destination_recipient_limit are at their default values:

default_destination_recipient_limit = 50
error_destination_recipient_limit = $default_destination_recipient_limit
my_filter_destination_recipient_limit = $default_destination_recipient_limit
lmtp_destination_recipient_limit = $default_destination_recipient_limit
local_destination_recipient_limit = 1
relay_destination_recipient_limit = $default_destination_recipient_limit
retry_destination_recipient_limit = $default_destination_recipient_limit
smtp_destination_recipient_limit = $default_destination_recipient_limit
virtual_destination_recipient_limit = $default_destination_recipient_limit

Thanks
Arshad
On Thu, Aug 30, 2018 at 10:52 PM Viktor Dukhovni <[hidden email]> wrote:


> On Aug 30, 2018, at 7:27 AM, Arshad Khan <[hidden email]> wrote:
>
> I have been using Postfix 2.6.6 on CentOS 6 which I have configured
> with an 'After-queue content filter'. The filter gets invoked when an
> email is received by Postfix. The content filter does some processing
> and pass on the message to another server from where the message is
> sent to the recipients.
>
> Recently I built version 2.11.11 and configured it to use the same
> content filter. However, now Postfix is invoking the content filter
> for each of the recipient. I would like it to invoke the filter once
> per message and not per recipient. What configuration setting should I
> alter to get the desired behaviour?

This is anecdotal retelling of your situation, with none of the supporting
evidence.  For useful help you need to post configuration information and
relevant logs.

For example, how is the content filter specified?  Is it just the transport
name or "transport:nexthop", ...  But instead of teasing out configuration
settings one by one with follow-up messages, see:

        http://www.postfix.org/DEBUG_README.html#mail

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: Postfix invoking content filter for each recipient

Viktor Dukhovni


> On Aug 30, 2018, at 9:56 PM, Arshad Khan <[hidden email]> wrote:
>
> Apologies for not being clear in my earlier message.
>
> What I want is for the content filter to be invoked once per message and not per recipient. I tried setting various values for *_destination_recipient_limit (including 1) to get the desired behavior. But no matter what value I set, Postfix still invokes the filter for each recipient. Here are the settings for filter in master.cf:
>
> 192.168.1.10:10025  inet    n   -   n   -   -   smtpd
>     -o content_filter=my_filter

Change that to:

        -o content_filter=my_filter:localhost

Otherwise, the envelope is split by recipient domain, message
envelopes are split by destination nexthop when the recipient
limit is > 1 (and by user when not).

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: Postfix invoking content filter for each recipient

Arshad Khan
Thanks Viktor.

Your suggestion worked perfectly :)

Seems like change in behavior between version 2.6.6 and 2.11.11 (or something got fixed?)

Thanks
Arshad

On Fri, Aug 31, 2018 at 10:15 AM Viktor Dukhovni <[hidden email]> wrote:


> On Aug 30, 2018, at 9:56 PM, Arshad Khan <[hidden email]> wrote:
>
> Apologies for not being clear in my earlier message.
>
> What I want is for the content filter to be invoked once per message and not per recipient. I tried setting various values for *_destination_recipient_limit (including 1) to get the desired behavior. But no matter what value I set, Postfix still invokes the filter for each recipient. Here are the settings for filter in master.cf:
>
> 192.168.1.10:10025  inet    n   -   n   -   -   smtpd
>     -o content_filter=my_filter

Change that to:

        -o content_filter=my_filter:localhost

Otherwise, the envelope is split by recipient domain, message
envelopes are split by destination nexthop when the recipient
limit is > 1 (and by user when not).

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: Postfix invoking content filter for each recipient

Viktor Dukhovni


> On Aug 30, 2018, at 10:32 PM, Arshad Khan <[hidden email]> wrote:
>
> Seems like change in behavior between version 2.6.6 and 2.11.11 (or something got fixed?)

Tsk, tsk, ... you did not read the release notes for Postfix, 2.7, 2.8, 2.9, 2.10 and 2.11
which cumulatively cover all the important changes from Postfix 2.6:

https://github.com/vdukhovni/postfix/blob/master/postfix/RELEASE_NOTES-2.7#L55

[Incompat 20100117] The meaning of an empty filter next-hop destination
has changed (for example, "content_filter = foo:" or "FILTER foo:").
Postfix now uses the recipient domain, instead of using $myhostname
as in Postfix 2.6 and earlier.  To restore the old behavior specify
"default_filter_nexthop = $myhostname", or specify a non-empty
next-hop content filter destination.

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: Postfix invoking content filter for each recipient

Viktor Dukhovni


> On Aug 31, 2018, at 1:20 AM, Viktor Dukhovni <[hidden email]> wrote:
>
>
> https://github.com/vdukhovni/postfix/blob/master/postfix/RELEASE_NOTES-2.7#L55

Sorry, wrong line number:

  https://github.com/vdukhovni/postfix/blob/master/postfix/RELEASE_NOTES-2.7#L100

> [Incompat 20100117] The meaning of an empty filter next-hop destination
> has changed (for example, "content_filter = foo:" or "FILTER foo:").
> Postfix now uses the recipient domain, instead of using $myhostname
> as in Postfix 2.6 and earlier.  To restore the old behavior specify
> "default_filter_nexthop = $myhostname", or specify a non-empty
> next-hop content filter destination.

--
        Viktor.