How do I bounce back all mails over 50 recipients

Glenn Steen glenn.steen at
Mon Mar 15 11:49:05 GMT 2010

On 11 March 2010 08:50, ram <ram at> wrote:
> On Thu, 2010-03-11 at 09:14 +0200, Lyndon Labuschagne wrote:
> On 11 Mar 2010, at 7:39 AM, ram wrote:
>> I have a requirement that mails with  over 50 recipients should be
>> outright rejected or bounced back
>> I assumed this would have been pretty simple to configure in MailScanner
>> or my MTA ( postfix)
> its not an option I have used before but this might do it
> smtpd_recipient_limit (default: 1000)
> The maximal number of recipients that the Postfix SMTP server accepts per
> message delivery request.
> you would use the below in your file
> smtpd_recipient_limit = 50
> This works , but the first 50 recipients get the message , the rest get
> rejected
> Can I reject all message for all recipients
No, not really. The RFCs demand that any MTA who reject an RCPT TO: do
not change state. That is, it is required to remain in the state where
it will wait for more recipients or the DATA command.

What you could try do is drastically lower some other limits, like the
smtpd_recipient_overshoot_limit, so that the recipients after 50 count
as errors, and then set smtpd_soft_error_limit and
smtpd_hard_error_limit so that the conversation is discarded before a
message is actually sent. ... But think this throuigh carefully before
doing it, and is possible test it thoroughly... it could potentially
have some undesired effects for your normal mail flow.
Say that you adjust them to:
smtod_recipient_limit = 47
smtpd_soft_error_limit = 3
smtpd_hard_error_limit = 4
... then mail up to 50 reciåpients would be OK, but *any* error past
that (including, but not limited to, that 51:st recipient) would be
... delayed and .... "fatal" to the conversation;-).

-- Glenn
email: glenn < dot > steen < at > gmail < dot > com
work: glenn < dot > steen < at > ap1 < dot > se

More information about the MailScanner mailing list