# Outgoing user mail throughput limitations

**URL:** <https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892>\
**Category:** Improvements\
**Created:** [May 12, 2024, 1:42pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892 "2024-05-12T13:42:35Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![xxfogs](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/x/45deac/32.png) [@xxfogs](https://discourse.mailinabox.email/u/xxfogs)\
**Post date:** [May 12, 2024, 1:42pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/1 "2024-05-12T13:42:35Z")

</div>

Is it planned to implement officially supported outgoing user mail throughput limitations?

I find that such a feature would be quite useful as loss of passwords is quite common among regular users which in the worst case is going to lead to spam mail being sent out through my server.

It would be great if there was a way to limit outgoing mail to, e.g. 100 mail/hour in a way that wouldn’t interfere with other MIAB systems.

I have previously tried using policyd to achieve similar functionality, however that required modifications to postfix configuration which ended up breaking upgrade system and prevented incoming mail from arriving.

---

<div class="post-metadata">

**Author:** ![stylnchris](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/stylnchris/32/2189_2.png) [@stylnchris](https://discourse.mailinabox.email/u/stylnchris)\
**Post date:** [May 12, 2024, 2:10pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/2 "2024-05-12T14:10:55Z")

</div>

I am not aware of anything in the pipeline for this at the moment.

You can see the various pull requests here:  
[https://github.com/mail-in-a-box/mailinabox/pulls?q=is%3Apr+is%3Aopen](https://github.com/mail-in-a-box/mailinabox/pulls?q=is%3Apr+is%3Aopen)

This however doesn’t mean that it will be merged into the project. Generally speaking Josh (the project creator) tries “to accept changes that are in-scope, complete, simple to review, and don’t make running this project harder.”

---

<div class="post-metadata">

**Author:** ![xxfogs](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/x/45deac/32.png) [@xxfogs](https://discourse.mailinabox.email/u/xxfogs)\
**Post date:** [May 12, 2024, 3:02pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/3 "2024-05-12T15:02:55Z")

</div>

That’s quite a shame, would have expected there to be something like that planned. Maybe you have suggestions for achieving similar functionality?

---

<div class="post-metadata">

**Author:** ![vele](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/v/e5b9ba/32.png) [@vele](https://discourse.mailinabox.email/u/vele)\
**Post date:** [May 12, 2024, 3:37pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/4 "2024-05-12T15:37:13Z")

</div>

MIAB does not break main.cf on update

Just insert in  
sudo nano /etc/postfix/main.cf

smtpd\_client\_message\_rate\_limit = 100  
anvil\_rate\_time\_unit = 86400s

This limit only refers to a client from a particular IP address. But it is a good start for protecting against abuse. There are other more complicated limits…

Read here if [https://www.postfix.org/postconf.5.html#smtpd\_client\_message\_rate\_limit](https://www.postfix.org/postconf.5.html#smtpd_client_message_rate_limit)

And confirm that this is correctly what you want to achieve.  
100 client message requests per day

---

<div class="post-metadata">

**Author:** ![xxfogs](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/x/45deac/32.png) [@xxfogs](https://discourse.mailinabox.email/u/xxfogs)\
**Post date:** [May 12, 2024, 3:43pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/5 "2024-05-12T15:43:14Z")

</div>

Better than nothing, but quite suboptimal… still thanks! Wouldn’t the correct anvil\_rate\_time\_unit property in this case be 3600s though?

---

<div class="post-metadata">

**Author:** ![vele](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/v/e5b9ba/32.png) [@vele](https://discourse.mailinabox.email/u/vele)\
**Post date:** [May 12, 2024, 3:53pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/6 "2024-05-12T15:53:00Z")

</div>

I thought you seek 100 per 24 hours. 86400 Be ware this limits clients from an IP such as Thunderbird… It will not limit a Roundcube webmail session.

For more fine grained limits use [mtpolicyd - Getting started with mtpolicyd](https://www.mtpolicyd.org/getting-started.html)

---

<div class="post-metadata">

**Author:** ![xxfogs](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/x/45deac/32.png) [@xxfogs](https://discourse.mailinabox.email/u/xxfogs)\
**Post date:** [May 12, 2024, 4:37pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/7 "2024-05-12T16:37:47Z")

</div>

My bad. I mistyped in the original question.

As for the mtpolicyd, I can’t seem to find tutorials for rate limiting with it

---

<div class="post-metadata">

**Author:** ![stylnchris](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/stylnchris/32/2189_2.png) [@stylnchris](https://discourse.mailinabox.email/u/stylnchris)\
**Post date:** [May 13, 2024, 12:15am UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/8 "2024-05-13T00:15:21Z")

</div>

Also consider clients that are Mobile (Smart Phones, iPads w/ Cellular) etc…

---

<div class="post-metadata">

**Author:** ![JoshData](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/joshdata/32/2153_2.png) [@JoshData](https://discourse.mailinabox.email/u/JoshData)\
**Post date:** [May 13, 2024, 11:22am UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/9 "2024-05-13T11:22:04Z")

</div>

> [@xxfogs](#):
>
> Better than nothing, but quite suboptimal…

Comments like this are disparaging to the project. Don’t do that.

---

<div class="post-metadata">

**Author:** ![xxfogs](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/x/45deac/32.png) [@xxfogs](https://discourse.mailinabox.email/u/xxfogs)\
**Post date:** [May 13, 2024, 4:25pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/10 "2024-05-13T16:25:57Z")

</div>

Any other ideas in that case? It would be the best if I could apply it on a by-user basis regardless of the client.

policyd was theoretically able to do that, but I have bad experience with it as described above.

---

<div class="post-metadata">

**Author:** ![xxfogs](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/x/45deac/32.png) [@xxfogs](https://discourse.mailinabox.email/u/xxfogs)\
**Post date:** [May 13, 2024, 4:26pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/11 "2024-05-13T16:26:37Z")

</div>

Sorry. Didn’t mean it to sound like that.

---

<div class="post-metadata">

**Author:** ![vele](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/v/e5b9ba/32.png) [@vele](https://discourse.mailinabox.email/u/vele)\
**Post date:** [May 13, 2024, 7:02pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/12 "2024-05-13T19:02:20Z")

</div>

> **[postfwd - postfix firewall daemon](http://postfwd.org/)**
>
> postfwd a postfix firewall policy daemon

> **[postfwd - rate limit examples](http://postfwd.org/ratelimits.html)**
>
> postfwd version differences

Read the part about postfwd. It seems painful.

> <https://serverfault.com/questions/290684/postfix-limiting-the-rate-at-which-a-particular-user-can-send-email>

---

<div class="post-metadata">

**Author:** ![vele](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/v/e5b9ba/32.png) [@vele](https://discourse.mailinabox.email/u/vele)\
**Post date:** [May 15, 2024, 2:22pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/13 "2024-05-15T14:22:38Z")

</div>

@Alento as far as I know is an owner of a website where he sells email delivery services where rate limits are applied. Maybe you can ask him how he implemented this on per-user basis.

---

<div class="post-metadata">

**Author:** ![xxfogs](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/x/45deac/32.png) [@xxfogs](https://discourse.mailinabox.email/u/xxfogs)\
**Post date:** [May 15, 2024, 4:00pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/14 "2024-05-15T16:00:45Z")

</div>

Thanks for this all @vele, I will write to Alento and experiment

---

<div class="post-metadata">

**Author:** ![system](https://discourse.mailinabox.email/uploads/default/original/2X/4/4d0933d13c456b7e57f296aa6cc344525b6f0c70.png) [@system](https://discourse.mailinabox.email/u/system)\
**Post date:** [July 12, 2024, 1:43pm UTC](https://discourse.mailinabox.email/t/outgoing-user-mail-throughput-limitations/11892/15 "2024-07-12T13:43:20Z")

</div>

This topic was automatically closed after 61 days. New replies are no longer allowed.
