New option DOVECOT_MAILBOX_FORMAT

This commit is contained in:
Germain Masse 2019-10-17 15:26:44 +02:00 committed by Germain Masse
parent d764d89ea9
commit 36afac7726
4 changed files with 27 additions and 3 deletions

View File

@ -357,6 +357,13 @@ Set the message size limit for all users. If set to zero, the size will be unlim
- drop => Drop the connection immediately with a 521 SMTP reply. Repeat this test the next time the client connects.
- ignore => Ignore the failure of this test. Allow other tests to complete. Repeat this test the next time the client connects. This option is useful for testing and collecting statistics without blocking mail.
##### DOVECOT_MAILBOX_FORMAT
- **maildir** => uses very common Maildir format, one file contains one message
- sdbox => (experimental) uses Dovecot high-performance mailbox format, one file contains one message
- mdbox ==> (experimental) uses Dovecot high-performance mailbox format, multiple messages per file and multiple files per box
This option has been added in November 2019. Using other format than Maildir is considered as experimental in docker-mailserver and should only be used for testing purpose. For more details, please refer to [Dovecot Documentation](https://wiki2.dovecot.org/MailboxFormat).
## Reports

View File

@ -216,6 +216,10 @@ DOVECOT_USER_FILTER=
# e.g. `"(&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%n))"`
DOVECOT_PASS_FILTER=
# Define the mailbox format to be used
# default is maildir, supported values are: sdbox, mdbox, maildir
DOVECOT_MAILBOX_FORMAT=maildir
# -----------------------------------------------------------------------------------------------------------------------------
# ---------------- Postgrey section -------------------------------------------------------------------------------------------
# -----------------------------------------------------------------------------------------------------------------------------

View File

@ -52,12 +52,12 @@ shift $((OPTIND-1))
-e "s/"$USER",//g" $ALIAS_DATABASE
[ $? = 0 ] && echo "$USER and potential aliases deleted." || errex "Aliases for $USER couldn't be deleted in $ALIAS_DATABASE. $?"
if [ "$MAILDEL" != "y" ]; then
read -p "Do you want to delete the maildir as well(all mails will be removed)?(y/n) " MAILDEL
read -p "Do you want to delete the mailbox as well(all mails will be removed)?(y/n) " MAILDEL
echo
fi
[ "$MAILDEL" != "y" ] && errex "Leaving the maildir untouched. If you want to delete it at a later point use \"sudo docker exec mail rm -R /var/mail/${MAILARR[1]}/${MAILARR[0]}\""
[ "$MAILDEL" != "y" ] && errex "Leaving the mailbox untouched. If you want to delete it at a later point use \"sudo docker exec mail rm -R /var/mail/${MAILARR[1]}/${MAILARR[0]}\""
rm -r -f /var/mail/${MAILARR[1]}/${MAILARR[0]}
[ $? = 0 ] && echo "Maildir deleted." || errex "Maildir couldn't be deleted: $?"
[ $? = 0 ] && echo "Mailbox deleted." || errex "Mailbox couldn't be deleted: $?"
done
) 200<$DATABASE

View File

@ -17,6 +17,7 @@ DEFAULT_VARS["FETCHMAIL_POLL"]="${FETCHMAIL_POLL:="300"}"
DEFAULT_VARS["ENABLE_LDAP"]="${ENABLE_LDAP:="0"}"
DEFAULT_VARS["LDAP_START_TLS"]="${LDAP_START_TLS:="no"}"
DEFAULT_VARS["DOVECOT_TLS"]="${DOVECOT_TLS:="no"}"
DEFAULT_VARS["DOVECOT_MAILBOX_FORMAT"]="${DOVECOT_MAILBOX_FORMAT:="maildir"}"
DEFAULT_VARS["ENABLE_POSTGREY"]="${ENABLE_POSTGREY:="0"}"
DEFAULT_VARS["POSTGREY_DELAY"]="${POSTGREY_DELAY:="300"}"
DEFAULT_VARS["POSTGREY_MAX_AGE"]="${POSTGREY_MAX_AGE:="35"}"
@ -586,6 +587,18 @@ function _setup_dovecot() {
sed -i -e 's/#ssl = yes/ssl = required/g' /etc/dovecot/conf.d/10-ssl.conf
sed -i 's/^postmaster_address = .*$/postmaster_address = '$POSTMASTER_ADDRESS'/g' /etc/dovecot/conf.d/15-lda.conf
# Set mail_location according to mailbox format
case "$DOVECOT_MAILBOX_FORMAT" in
sdbox|mdbox|maildir )
notify 'inf' "Dovecot $DOVECOT_MAILBOX_FORMAT format configured"
sed -i -e 's/^mail_location = .*$/mail_location = '$DOVECOT_MAILBOX_FORMAT':\/var\/mail\/%d\/%n/g' /etc/dovecot/conf.d/10-mail.conf
;;
* )
notify 'inf' "Dovecot maildir format configured (default)"
sed -i -e 's/^mail_location = .*$/mail_location = maildir:\/var\/mail\/%d\/%n/g' /etc/dovecot/conf.d/10-mail.conf
;;
esac
# Enable Managesieve service by setting the symlink
# to the configuration file Dovecot will actually find
if [ "$ENABLE_MANAGESIEVE" = 1 ]; then