WebMail Pro PHP documentation

Authentication via custom non-IMAP backend

By default, WebMail Pro authenticates user via IMAP. It's also possible to disable IMAP authentication so that user account credentials are checked against the database only.

There's one more option available - you can make WebMail Pro authenticate users via a different backend, LDAP for example. It can be useful if you don't need webmail part of the product and wish to use other modules - calendar, files, etc.

To log in via custom backend, you'll need to use the hook called api-integrator-login-to-account, it has the following parameters passed by reference:

&$sEmail - email

&$sPassword - password

&$sLogin - login

&$sLanguage - language name

&$bAuthResult - result of function execution

Upon processing the hook, any of those parameters can be redefined. If the function sets $bAuthResult to true, the account is looked up in the database based on &$sLogin variable, and if the account wasn't found, it will be created. Mailserver details are retrieved based on domain part of &$sEmail, and if there's no matching domain, default domain settings are used.

You can find an example of using this approach at:

Plugins: Authentication via LDAP in Active Directory