Page 1 of 1

How to limit sending number of email address in per mail

Posted: Fri Nov 09, 2018 5:00 am
by arif.meman
Hi All,

How to limit number of email addresses one user can send per mail.

what i want to do is, i want to limit every user to restrict.

like, for one user, i want that, he can send only 50 email addresses in one mail, in To, CC or BCC.

is that possible?

Re: How to limit sending number of email address in per mail

Posted: Fri Nov 09, 2018 8:38 am
by afsher
After executing the below policy, users shall not be able to add more than 10 email addresses in a message to/cc/bcc field.

Step 1: Login as a Zimbra user and check current limit.

root@mail:~# su – zimbra

Check the current limit:

zimbra@mail:~$ postconf | grep smtpd_recipient_limit
smtpd_recipient_limit = 1000 ##This is the default recipient limit

Step 2: Restrict recipient limit to 10

zimbra@mail:~$ postconf -e 'smtpd_recipient_limit = 10'

It will restrict the recipient limit to 10. You may adjust the number based on your scenario.

Step 3: Apply Settings

zimbra@mail:~$ postfix reload

After applying this settings, you will get an error while sending a message greater than the
threshold value (in this case: 10).

Re: How to limit sending number of email address in per mail

Posted: Fri Oct 16, 2020 2:24 pm
by alogicking
Hi All,

I wanted to implement this (limiting the sending number of email address per mail) on my server for all incoming emails from external domains (any domains not hosted on our email server) but don't want the number of recipients restrictions if the emails are being sent from the domains hosted on our own server. Is it possible? If yes, then can you share some details how do we achieve it?

We are using: RHEL7_64 FOSS edition, 8.8.15 Patch 12

Regards

Re: How to limit sending number of email address in per mail

Posted: Sat Oct 17, 2020 3:48 pm
by L. Mark Stone
alogicking wrote:Hi All,

I wanted to implement this (limiting the sending number of email address per mail) on my server for all incoming emails from external domains (any domains not hosted on our email server) but don't want the number of recipients restrictions if the emails are being sent from the domains hosted on our own server. Is it possible? If yes, then can you share some details how do we achieve it?

We are using: RHEL7_64 FOSS edition, 8.8.15 Patch 12

Regards


Check out CBPolicyd:
https://wiki.zimbra.com/wiki/How-to_for_cbpolicyd
https://wiki.zimbra.com/wiki/Cluebringer_Policy_Daemon
https://wiki.zimbra.com/wiki/King0770-N ... -CBPOLICYD

Hope that helps,
Mark

Re: How to limit sending number of email address in per mail

Posted: Sun Oct 18, 2020 3:00 pm
by alogicking


Hi Mark,

Thanks for your response and sorry If I was not clear with what I wanted to achieve. I do have policyd enabled on my server and I am limiting the message delivery rates as per minutes/hours/day . let me know how I can achieve the below setup using policyd or with smtpd_recipient_limit

The requirement I have is to restrict the delivery of any email which has more than x number of recipient (can be 10 or 20 or something I wanted including to/cc/bcc) in any specific email message if the email is sent from external domain and not from the domains hosted on my mail server.

afsher mentioned the steps as below:

Restrict recipient limit to 10

Code: Select all

zimbra@mail:~$ postconf -e 'smtpd_recipient_limit = 10


I wanted to know if I use the above steps as mentioned by afsher on my email server, how to restrict it to work only for external domains mail ids and not the internal email ids.

Hope I am clear with the requirement this time.

Regards

Re: How to limit sending number of email address in per mail

Posted: Mon Oct 19, 2020 4:26 pm
by L. Mark Stone
Ah, now I understand, thanks for clarifying!

So to restrict the number of recipients in each individual email to ten globally, you'll need to do as the zimbra user:

Code: Select all

postconf -e smtpd_recipient_limit=9
postconf -e smtpd_recipient_overshoot_limit=1


Both of those settings have a default value of 1,000, so just configuring smtpd_recipient_limit alone isn't sufficient.

If the user then puts eleven recipients in the to: and/or cc: and/or bcc: fields in the web client, and then hits the Send button, Zimbra will give them an error about too many recipients.

These settings will survive most Zimbra Patches, but if a Patch also includes a new MTA package, I would double check that the settings are still in place, like so:

Code: Select all

postconf -n | grep smtpd_recipient | grep limit
smtpd_recipient_limit = 9
smtpd_recipient_overshoot_limit = 1


To do the sending restrictions on a per-domain basis, you'll need to use cbpolicyd.

Hope that helps,
Mark