HEX
Server: Apache/2.2.34 (Unix) mod_fastcgi/mod_fastcgi-SNAP-0910052141
System: Linux Kou-Etsu-Dou 4.4.59+ #25556 SMP PREEMPT Thu Mar 4 18:03:46 CST 2021 x86_64
User: hosam (1026)
PHP: 7.2.29
Disabled: NONE
Upload Files
File: /volume1/@appstore/MailPlus-Server/etc/template/90-quota.template
##
## Quota configuration.
##

# Note that you also have to enable quota plugin in mail_plugins setting.
# <doc/wiki/Quota.txt>

##
## Quota limits
##

# Quota limits are set using "quota_rule" parameters. To get per-user quota
# limits, you can set/override them by returning "quota_rule" extra field
# from userdb. It's also possible to give mailbox-specific limits, for example
# to give additional 100 MB when saving to Trash:

# Avoid spending excessive time waiting for the quota calculation to finish when
# mails' vsizes aren't already cached. If this many mails are opened, finish the
# quota calculation on background in indexer-worker process. Mail deliveries will
# be assumed to succeed, and explicit quota lookups will return internal error.
# (v2.2.28+)
mail_vsize_bg_after_count = 100

plugin {
  # quota engine: quota root
  quota = count:User quota
  # This is required - it uses "virtual sizes" rather than "physical sizes" for quota counting:
  quota_vsizes = yes

  # __QUOTA_RULE__

  #quota_rule = *:storage=1G
  # ignore the quota setting of the mailboxes under shared mailbox namespace
  quota_rule2 = synology_internal_shared_namespace*:ignore

  # LDA/LMTP allows saving the last mail to bring user from under quota to
  # over quota, if the quota doesn't grow too high. Default is to allow as
  # long as quota will stay under 10% above the limit. Also allowed e.g. 10M.
  #quota_grace = 10%%

  # Quota plugin can also limit the maximum accepted mail size.
  #quota_max_mail_size = 100M

  ##
  ## Quota warnings
  ##

  # You can execute a given command when user exceeds a specified quota limit.
  # Each quota root has separate limits. Only the command for the first
  # exceeded limit is executed, so put the highest limit first.
  # The commands are executed via script service by connecting to the named
  # UNIX socket (quota-warning below).
  # Note that % needs to be escaped as %%, otherwise "% " expands to empty.

  # __QUOTA_WARNING__
}

# Example quota-warning service. The unix listener's permissions should be
# set in a way that mail processes can connect to it. Below example assumes
# that mail processes run as vmail user. If you use mode=0666, all system users
# can generate quota warnings to anyone.
service quota-warning {
  executable = script -e PATH /var/packages/MailPlus-Server/target/scripts/quota_warn.py
  unix_listener quota-warning {
    mode = 0666
  }
}

plugin {
  quota_clone_dict = redis:host=127.0.0.1:port=8506
}

##
## Quota backends
##

# Multiple backends are supported:
#   dirsize: Find and sum all the files found from mail directory.
#            Extremely SLOW with Maildir. It'll eat your CPU and disk I/O.
#   dict: Keep quota stored in dictionary (eg. SQL)
#   maildir: Maildir++ quota
#   fs: Read-only support for filesystem quota

plugin {
  #quota = dirsize:User quota
  #quota = maildir:User quota
  #quota = dict:User quota::proxy::quota
  #quota = fs:User quota
}

# Multiple quota roots are also possible, for example this gives each user
# their own 100MB quota and one shared 1GB quota within the domain:
plugin {
  #quota = dict:user::proxy::quota
  #quota2 = dict:domain:%d:proxy::quota_domain
  #quota_rule = *:storage=102400
  #quota2_rule = *:storage=1048576
}

# Quota service
# -------------

# The quota service allows postfix to check quota before delivery:

plugin {
    quota_status_success = DUNNO
    quota_status_nouser = DUNNO
    quota_status_overquota = "552 5.2.2 Quota exceeded (mailbox for user is full)"
}

service quota-status {
    executable = quota-status -p postfix
    inet_listener {
        port = 12340
        # You can choose any port you want
    }
    client_limit = 1
}

# And then have postfix check_policy_service check that:

# ---%<-------------------------------------------------------------------------
# smtpd_recipient_restrictions =
#     ...
#     check_policy_service inet:mailstore.example.com:12340
# ---%<-------------------------------------------------------------------------