diff --git a/templates/main.cf.j2 b/templates/main.cf.j2 index bff0fae..b45178c 100644 --- a/templates/main.cf.j2 +++ b/templates/main.cf.j2 @@ -83,14 +83,24 @@ smtpd_recipient_restrictions = permit_mynetworks, {% if ("virtual_transport" in postfix and postfix.virtual_transport == "dovecot") or postfix.ldap.enable %} +{# This applies when LDAP or dovecot are configured #} smtpd_sasl_auth_enable = yes {% endif %} -{% if "virtual_transport" in postfix and postfix.virtual_transport == "dovecot" %} +{% if ("virtual_transport" in postfix and postfix.virtual_transport == "dovecot") + and postfix.ldap.enable +%} +{# This applies when dovecot and LDAP are configured #} +dovecot_destination_recipient_limit = 1 +virtual_transport = dovecot +{% endif %} + +{% if ("virtual_transport" in postfix and postfix.virtual_transport == "dovecot") + and not postfix.ldap.enable +%} +{# This applies when dovecot is configured, but not LDAP #} smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth -smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination - dovecot_destination_recipient_limit = 1 virtual_transport = dovecot {% endif %}