From: ram on
I need to reject messages above n recipients with a Permanent Failure.

If I configure smtpd_recipient_limit=50
I cant outright reject the messages unless I set
smtpd_hard_error_limit=1





Thanks
Ram

From: Noel Jones on
On 3/11/2010 2:18 AM, ram wrote:
> I need to reject messages above n recipients with a Permanent Failure.

Why? This sounds like a misguided request.


>
> If I configure smtpd_recipient_limit=50

This parameter is intended to limit total recipients per
delivery, not the whole message including previous recipients.

At any rate, this parameter signals the sender to try the
extra recipients later in a separate delivery, and does not
actually reject them.

> I cant outright reject the messages unless I set
> smtpd_hard_error_limit=1

That causes postfix to disconnect, not to reject. Assuming
the sender is a real MTA, it will continue to reconnect and
retry until their queue expires. That will probably be 5 days
or so, resulting in hundreds of useless attempts.

Postfix isn't designed to reject a whole message based on
total number of recipients. If you really need this, you'll
need some external check, either a postfix policy service or a
milter.

This could be done with a policy service, called once at each
RCPT TO to count the recipients, then called again at DATA to
see if the whole message should be rejected.
http://www.postfix.org/SMTPD_POLICY_README.html

There may be a milter with such a feature, you'll need to
google around.


-- Noel Jones