Postfix limit number of emails send in a month/Day

7,527

The tool you need is the cluebringer otherwise known as policyd. It will allow you to assign quotas of all sorts (and many other functions), and importantly, allows you to count users by more immutable criteria, like their SASLUsername, allowing you to be fairly confident that people won't be able to sneak around limits by changing sending email.

Share:
7,527

Related videos on Youtube

user103373
Author by

user103373

Updated on September 18, 2022

Comments

  • user103373
    user103373 over 1 year

    Is it possible to limit the users to send total email in a month/day. I am trying to enforced marketing users to send newsletter according to their assigned quota.

    Example 1. [email protected]: can send only 100 emails a day & 3000 emails in a month. 2. [email protected]: can send only 200 emails a day & 6000 emails in a month.

    VPS: Centos6 MTA: postfix

    • NickW
      NickW about 10 years
      Since you haven't mentioned what sort of authentication you use (if any) you can use something like this: Policy: Default Outbound Policy Track: Sender:[email protected] Period: Monthly MessageCountLimit: 3000 MessageSizeLimit: Verdict: REJECT Data: "Sending limit exceeded"
    • NickW
      NickW about 10 years
      You also need to be sure you enable accounting in policyd.conf, and load the Postfix protocol, and ensure that this is set up as both smtpd_recipient_restrictions and smtpd_end_of_data_restrictions: pointing to check_policy_service inet:127.0.0.1:10031
  • MadHatter
    MadHatter about 10 years
    +1 from me, typically great NickW answer. Also, what a great project name; I have visions of an albino sysadmin with a giant black LART, which radiates an evil light whilst crooning a vile, but highly-informative, song.
  • NickW
    NickW about 10 years
    The name cluebringer definitely strikes a nerve with many an email administrator :D
  • user103373
    user103373 about 10 years
    Thanks nick, As you suggested i haved installed the cluebringer. These are the settings of main.cf "smtpd_recipient_restrictions = check_policy_service inet:127.0.0.1:10031, permit mynetworks, reject_unauth_destination smtpd_end_of_data_restrictions = check_policy_service inet:127.0.0.1:10031 "
  • user103373
    user103373 about 10 years
    Also, I have added a rule to send only 3 messages in 3600 secs. but still i am able to send more than 3 messages. Can you please help me to create the rules if i did something wrong!!!
  • MadHatter
    MadHatter about 10 years
    user103373, if you have supplementary questions it's best to edit them into your existing question (or even start a new question, referencing this one) not post them as a comment. Note also that it's polite to accept the answer that best helps you, by clicking on the tick outline next to it. That drives the SF reputation system both for you and the author of that answer; my apologies if you already knew that.
  • NickW
    NickW about 10 years
    Yeah, we can probably help you to set up some rules, if you can do as MadHatter asked.
  • user103373
    user103373 about 10 years
    Hi guys can you help me to setup the rules.