CBPolicyD has some modules and one of them is module accounting. What is usability of module accounting? with module accounting, we can rate limit sending/receipt email with daily, weekly and monthly method. Even Gmail, Yahoo or other email also limit sending/receipt email perday. You can see that information at this link : http://www.yetesoft.com/free-email-marketing-resources/email-sending-limit/.
Now, how we can also make like Gmail or Yahoo to limit sending email/receipt per day, per week or per month? with CBPolicyD accounting module, we also can do that. Previously, you should be enable CBPolicyD on your Zimbra mail server. If you are using Zimbra 8.5, you can use this guidance : http://imanudin.net/2014/09/08/how-to-install-policyd-on-zimbra-8-5/
For activating module accounting, open webui via browser, choose accounting | configure. Select add, and fill with the following example
Name : Rate limit perday Link to policy : Default Track : Sender:@domain . You can choose with your choice Period : Daily Message Count Limit : 5000 Message Cumulative Size Limit : empty. I am not using cumulative size Verdict : HOLD. Data : You can fill with information if policy has been fulfilled. for example, you can fill with "Sorry, your maximum email perday have been full" Stop processing here : No Comment : You can fill with comment or emptied Disabled : No
If no tables for module accounting and get information “no such table” while create rule, you can manually adding tables accounting to sqlite.
cd /opt/zimbra/cbpolicyd/share/database/ ./convert-tsql sqlite accounting.tsql > /tmp/accounting.sql vi /tmp/accounting.sql
Delete all lines starting with # (comment) and saved. Inject database to sqlite
sqlite3 /opt/zimbra/data/cbpolicyd/db/cbpolicyd.sqlitedb < /tmp/accounting.sql
Don’t forget to enable accounting module on Zimbra
su - zimbra zmprov ms `zmhostname` zimbraCBPolicydAccountingEnabled TRUE zmcbpolicydctl restart
please check log cbpolicyd.log and you can get information like below
[2014/11/29-21:33:37 - 27354] [CORE] INFO: module=Accounting, mode=update, host=127.0.0.1, helo=mail.example.com, firstname.lastname@example.org, email@example.com, reason=accounting_update, policy=1, accounting=2, track=Sender:@example.com, period=2014-11-29, count=2/5000 (0.0%), size=0/-
Good luck and hopefully useful 😀