Posts Tagged ‘recipient limit’

How to limit the number of recipients in Postfix

No Comments »

 

1) If you wish to limit the total number of recipients in an email, you can do that using the variable:

smtpd_recipient_limit=10
# postconf -e 'smtpd_recipient_limit=10'
# /etc/init.d/postfix restart

2) If you wish to specifically limit the number if recipients in TO and CC. You can do that with the option in main.cf:

header_checks = regexp:/etc/postfix/header_checks

contents of /etc/postfix/header_checks

/^To:([^@]*@){50,}/ REJECT Sorry, your message has too many recepients.
/^Cc:([^@]*@){50,}/ REJECT Sorry, your message has too many recepients.

This will not work for BCC. By the time the message gets to header_checks, the BCC header will be already removed.