Because of its complex, machine-friendly syntax, LDAP is primarily suited for scripting. While it is relatively easy for a programmer to write a script that sends a weekly notice to every member of a particular department, it is not realistic to expect ordinary list owners or end-users to understand the intricacies of LDAP and devise working search filters. For instance, to select all users in an Exchange database, one would have to use the following filter:

(&(!(Alias=$null))(|(&(ObjectCategory=person)(ObjectClass=user)(Database=$null)(ServerLegacyDN=$null))(&(ObjectCategory=person)(ObjectClass=user)(!(Database=$null))(!(ServerLegacyDN=$null)))))))


L-Soft expects that LDAP-based distributions will be created by customer-developed scripts – either intranet web scripts or traditional ‘cron’ jobs or scheduled tasks. At this point, there are no plans to provide a web interface page into which raw LDAP search filters could be entered.

To create an LDAP-based distribution, a script uses the DISTRIBUTE command and specifies an LDAP keyword as follows:

DISTRIBUTE … LDAP=YES(SERVER=nickname,E-MAIL=attribute,PARTS=attribute)


The syntax of this keyword is essentially the same as for SQL-based distributions (“DBMS=”):

    • SERVER=nickname

Identifies the LDAP server to be queried. If omitted, the default (unnamed) LDAP server is used.

    • E-MAIL=attribute

Identifies the name of the directory attribute containing the recipient’s e-mail address. If omitted, the value of LDAP_DEFAULT_EMAIL_nickname is used.

    • PARTS=attribute

The name of an optional directory attribute containing a list of message parts that the recipient subscribes to. Although this mail-merge feature is unlikely to be used with LDAP, it is available if desired.

Note: The E-MAIL and (if enabled) PARTS attributes must be specified or the distribution will fail.


Similarly to SQL-based distributions, the ‘TO’ DD contains a list of LDAP search statements, rather than a list of actual recipients. Each line in the ‘TO’ DD can be one of the following statements:

    • BASE DN

The ‘distinguished name’ of the ‘base’ of the LDAP search. Mandatory.

    • FILTER search_filter


The LDAP search filter for the search. Mandatory.

    • ATTRS attr1 [attr2 […]]


A list of directory attributes of interest (used in the mail-merge). If omitted, all directory attributes are made available. Attribute names are not case-sensitive. The main purpose of this statement is to improve search performance if there are many irrelevant attributes in the directory.

    • SCOPE BASE|ONELEVEL|SUBTREE


Optionally changes the scope of the search from the default (SUBTREE).

    • SEARCH

Starts the search. This command allows multiple LDAP searches to be performed in the same distribution. If there is only one search, this command is optional – LISTSERV automatically starts the search when it reaches the end of the ‘TO’ DD.

For instance, this search will select all Windows users in the EXAMPLE.COM domain with a valid e-mail address:

BASE CN=Users,DC=EXAMPLE,DC=COM
FILTER (&(objectcategory=person)(objectclass=user))
ATTRS Name Mail Phone
SEARCH