Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to limit the number of recipients in Postfix?  (Read 2545 times)

0 Members and 1 Guest are viewing this topic.

lijeshk

  • Guest
How to limit the number of recipients in Postfix?
« on: December 28, 2013, 09:59:09 am »

  • If you wish to limit the total number of recipients in an email, you can do that using the variable:
             smtpd_recipient_limit=10

Code: [Select]
# postconf -e 'smtpd_recipient_limit=10'
# /etc/init.d/postfix restart

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

Code: [Select]
header_checks = regexp:/etc/postfix/header_checks
  • Contents of /etc/postfix/header_checks:

Code: [Select]
/^To:([^@]*@){50,}/ REJECT Sorry, your message has too many recipients.
/^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.

--

 :)