diff --git a/data/hooks/conf_regen/25-dovecot b/data/hooks/conf_regen/25-dovecot index 4c5ae24c1..d7136df4d 100755 --- a/data/hooks/conf_regen/25-dovecot +++ b/data/hooks/conf_regen/25-dovecot @@ -2,6 +2,8 @@ set -e +. /usr/share/yunohost/helpers + do_pre_regen() { pending_dir=$1 @@ -14,11 +16,10 @@ do_pre_regen() { cp dovecot-ldap.conf "${dovecot_dir}/dovecot-ldap.conf" cp dovecot.sieve "${dovecot_dir}/global_script/dovecot.sieve" - # prepare dovecot.conf conf file - main_domain=$(cat /etc/yunohost/current_host) - cat dovecot.conf \ - | sed "s/{{ main_domain }}/${main_domain}/g" \ - > "${dovecot_dir}/dovecot.conf" + export pop3_enabled="$(yunohost settings get 'pop3.enabled')" + export main_domain=$(cat /etc/yunohost/current_host) + + ynh_render_template "dovecot.conf" "${dovecot_dir}/dovecot.conf" # adapt it for IPv4-only hosts if [ ! -f /proc/net/if_inet6 ]; then diff --git a/data/templates/dovecot/dovecot.conf b/data/templates/dovecot/dovecot.conf index 116bb2db7..477ccbfb1 100644 --- a/data/templates/dovecot/dovecot.conf +++ b/data/templates/dovecot/dovecot.conf @@ -8,11 +8,10 @@ mail_home = /var/mail/%n mail_location = maildir:/var/mail/%n mail_uid = 500 -protocols = imap sieve +protocols = imap sieve {% if pop3_enabled == "True" %}pop3{% endif %} mail_plugins = $mail_plugins quota - ssl = yes ssl_cert =