How to limit the number of recipients in Postfix
Friday, July 12th, 2013 - 12:50 pm - System Administration
1) If you wish to limit the total number of recipients in an email, you can do that using the variable:
1 | smtpd_recipient_limit=10 |
1 | # postconf -e 'smtpd_recipient_limit=10' |
1 | # /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:
1 | header_checks = regexp:/etc/postfix/header_checks |
contents of /etc/postfix/header_checks
1 | /^To:([^@]*@){50,}/ REJECT Sorry, your message has too many recepients. |
2 | /^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.