From 1488eeab9085214c9b430f64f27a5ed91f2132c3 Mon Sep 17 00:00:00 2001
From: Lars Beckers <lars.beckers@rwth-aachen.de>
Date: Mon, 26 Apr 2021 00:23:50 +0200
Subject: [PATCH] dovecot: add lda autocreate/autosubscribe options

---
 dovecot/defaults/main.yml               | 2 ++
 dovecot/templates/conf.d/15-lda.conf.j2 | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dovecot/defaults/main.yml b/dovecot/defaults/main.yml
index f656071..b253b5b 100644
--- a/dovecot/defaults/main.yml
+++ b/dovecot/defaults/main.yml
@@ -35,6 +35,8 @@ dovecot_sieve: 'file:~/sieve;active=~/.dovecot.sieve'
 
 # These variables were introduced for compatibility to a certain setup.
 # They may disappear without prior notice and/or may not work as expected.
+dovecot_lda_mailbox_autocreate: false
+dovecot_lda_mailbox_autosubscribe: false
 dovecot_auth_realms: []
 dovecot_auth_default_realm: ''
 dovecot_auth_krb5_keytab: ''
diff --git a/dovecot/templates/conf.d/15-lda.conf.j2 b/dovecot/templates/conf.d/15-lda.conf.j2
index 47e83de..cdce6e3 100644
--- a/dovecot/templates/conf.d/15-lda.conf.j2
+++ b/dovecot/templates/conf.d/15-lda.conf.j2
@@ -37,10 +37,10 @@
 #lda_original_recipient_header =
 
 # Should saving a mail to a nonexistent mailbox automatically create it?
-#lda_mailbox_autocreate = no
+lda_mailbox_autocreate = {{ 'yes' if dovecot_lda_mailbox_autocreate else 'no' }}
 
 # Should automatically created mailboxes be also automatically subscribed?
-#lda_mailbox_autosubscribe = no
+lda_mailbox_autosubscribe = {{ 'yes' if dovecot_lda_mailbox_autosubscribe else 'no' }}
 
 protocol lda {
   # Space separated list of plugins to load (default is global mail_plugins).
-- 
GitLab