<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 06/12/2020 21:13, Peter Folta wrote:<br>
</div>
<blockquote type="cite"
cite="mid:A1F6FEEA-5CDE-46D8-BCA6-F20F9605C5CF@peterfolta.net">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="">[Dovecot version 2.3.11.3 (502c39af9)]</div>
<div class=""><br class="">
</div>
Hi all,
<div class=""><br class="">
</div>
<div class="">I’m using Dovecot’s quota-status service to let
Postfix check the recipient’s quota before accepting emails
following the guide here: <a
href="https://blog.sys4.de/postfix-dovecot-mailbox-quota-en.html"
class="" moz-do-not-send="true">https://blog.sys4.de/postfix-dovecot-mailbox-quota-en.html</a>. This
works well for inbound emails.</div>
<div class=""><br class="">
</div>
<div class="">I would like to set up something similar for
outbound email, i.e. if a user is over quota, they should not be
allowed to send new emails. At the moment, the setup is in a bit
of an inconsistent state: Users that have exceeded their quota
are still able to send outbound emails but saving them in their
Sent folder will fail leaving them without a copy.</div>
<div class=""><br class="">
</div>
<div class="">I have tried using Dovecot’s quota-status in
Postfix’s smtpd_send_restrictions but didn’t get this to work. A
quick look at the Dovecot source code seems to suggest that the
quota-status plugin is only checking the recipient address: <a
href="https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c#L135-L146"
class="" moz-do-not-send="true">https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c#L135-L146</a> and <a
href="https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c#L109-L111"
class="" moz-do-not-send="true">https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c#L109-L111</a>.</div>
<div class=""><br class="">
</div>
<div class="">I suspect it’s not possible to use the quota-status
service to control outbound email but thought I’d ask to
confirm. I’m wondering if there’s a different way to achieve
this?</div>
<div class=""><br class="">
</div>
<div class="">Thanks</div>
<div class="">Peter</div>
</blockquote>
<p>Peter<br>
</p>
<p>The dovecot quota-status service only checks the recipient
address. In order to achieve this with the quota-status service,
you'd need to change the source code introducing the capability to
check the sender address. You'd also need a way to differentiate
when to use the existing capability to check recipient and when to
use the new capability to check sender. One way of doing that
would be to use the policy_context attribute available in Postfix
3.1 and later in order to differentiate whether you are calling
quota-status for inbound or outbound email, example:</p>
<pre>policy_context=submission</pre>
<p><a class="moz-txt-link-freetext" href="http://www.postfix.org/SMTPD_POLICY_README.html">http://www.postfix.org/SMTPD_POLICY_README.html</a></p>
<p>John<br>
</p>
</body>
</html>