> On Mar 21, 2017, at 11:59 AM, pandorasbox55 <pandorasbo...@outlook.com> wrote: > > Hi - > > I am trying to find out if there is a way to send alternate error responses > based on the results of an LDAP query. > > For example, the current LDAP query checks to see if an account is active > and has the necessary email attributes and routes email accordingly. If an > account does not meet the requirements an error message is returned of user > unknown (which is correct based on the query). > > I would like to add a query so if the account has the proper mail attributes > (thus exists) but is disabled (not active) then a different error response > would be returned, such as "this account is disabled and cannot receive > mail" vs "user unknown".
See: http://www.postfix.org/access.5.html main.cf: ldap = proxy:ldap:${config_directory}/ smtpd_recipient_restrictions = ... check_recipient_access ${ldap}ldap-rcpt-access.cf ldap-rcpt-access.cf: <your settings here> query_filter = <your query> result_attribute = mail size_limit = 1 expansion_limit = 1 result_format = 550 5.7.1 Blah, blah, blah %S blah, blah, blah -- Viktor.