The <EnumQuery> element is the SQL query to find all email addresses the database server will verify. The response should be one row for each email address and one for each alias. The columns of each row can contain:
- The email address or alias to be verified (the address which will be the argument of a verification command).
- The primary SMTP address. If this is non-NULL, then the first column contains an alias.
- The unique ID for that email address to be used in two-phase authentication. If NULL, two-phase authentication cannot be performed using enumerated data.
- The UNIX-style encrypted form for the user password. If NULL, authentication commands must use the <AuthQuery> element to check the password. If this is non-NULL, then authentication commands can be completed entirely within the application (after an enumeration has completed successfully). DataBase verifiers are the only type of verifier that can use internal authentication data to avoid querying the verification server. Do not create an <EnumQuery> element with SQL that will transport unencrypted passwords.
The following code snippet builds an enumeration from a table of email addresses and a table of aliases. There are no unique IDs nor are there passwords:
SELECT email_aliases.from_email AS Lookup,
email_accounts.email AS Aliased_To
FROM email_accounts INNER JOIN email_aliases
ON email_accounts.email = email_aliases.to_email