On 23/01/2015 19:40, Wietse Venema wrote:
Chris Robinson:
On 23/01/2015 17:14, Noel Jones wrote:
On 1/23/2015 7:42 AM, Chris Robinson wrote:
Hi all,

Is there any way to use the postfix policy delegation mechanism to
filter the transport:destination differently for individual
recipients in a multi-recipient message?
No, but maybe you can describe the problem, without assuming that
the policy service will be part of the solution.

If you described it 15 posts ago, it's unlikely anyone will remember it.

        Wietse
I did include a detailed description in my original post which seems to have 
got chopped out, but here's a precis:

I use an Amazon SES relay that has a max message size of 10MB. I have a small client base who sometimes send large documents as attachments. Sometimes they will send to multiple recipients which may include external and internal (local) addresses.

When this happens postfwd will get a hit on the EOM rule that detects size>9MB. The rule's action is "FILTER smtp:" in order to bypass the relay. This rule also has a pcre item that is meant to exclude local recipients from the hit but which was ignored (I realise now it's because we are dealing with the whole message) with the result that the external recipients got "mail loops back to myself".

I thought I might be able to use a before-message filter because the README says "1. Re-inject the mail back into Postfix via SMTP, perhaps after changing its content and/or destination." but I was not clear on how to change the destination and, in any case it would still apply to all the recipients I assume.

I thought I could use a postconf concurrency parameter to force postfix to split all messages into single recipient messages right at the SMTPD beginning so that postfwd got only single recipient messages but I could not make this happen. This would be the ideal solution.

I got these from Noel Jones and Victor Dukhovni:

> Noel Jones wrote:
>

On 1/23/2015 10:41 AM, Viktor Dukhovni wrote:
For custom per-user routing that depends on policy-based factors
force an extra SMTP hop for the entire message via a transport with
recipient concurrency set to 1.  On the receiving end of that you
can do per-user FILTER actions as messages will have only one user
at a time (delivered as many times as there are recipients).

For this specific application, it should be sufficient to use a
policy service FILTER action to send only big messages to a second
postfix instance, then let that second instance deliver mail
"normally" (normal local delivery, empty relayhost setting).  There
should be no need to set the concurrency to 1.

Messages under the target size can be delivered by the primary
instance to the relayhost, same as they currently are.

One way adds a second hop for all mail, the other makes some mail
"special".  I don't really like either of these choices.  If it's OK
to send big mail directly, why not just send it all directly.

  -- Noel Jones

Victor's solution doesn't mention a second instance of postfix but I take it that's implied(?). Presumably Noel's solution is the same as Victor's without the concurrency issue and they both require me to tackle multi-instance postfix. It's additional learning curve I had hoped to avoid.

Noel, the reason I don't send mail out directly is that a managed relay handles all the hassle of outbound mail filtering and I never have to worry about my IP being blacklisted again because of some slip up or oversight. And with my low volumes the cost is trivial.

Wietse, unless you can come up with a lovely simple way of handling multi-recipient routing, or unless Victor's solution does not involve a second instance of postfix, I think I will have to follow Noel's advice.

Thanks all,
Chris Robinson

Reply via email to