Allow LDAP Authentication using samAccountName

Author: ShinyMcMartinCreated Sep 26, 2026Updated Sep 26, 2026
Labelsenhancement

Summary

I would like Mailcow’s LDAP authentication to support logging in with either the user’s samAccountName or full email address.

Example environment

  • Active Directory: ad.my-domain.com
  • Mail domain: my-domain.com
  • samAccountName: max.mustermann
  • mail: [email protected]

Both usernames should authenticate against the same LDAP/AD account, using the same password, and resolve to the same Mailcow mailbox:

Suggested implementation

Support multiple LDAP login attributes:

  • samAccountName
  • mail

Conceptually, the LDAP search could use:

(|(samAccountName={username})(mail={username}))

The mailbox attribute remains mail.

Motivation

This would allow AD/LDAP environments to support both common login formats without choosing one exclusively. Applications using samAccountName and mail clients/users using the email address could authenticate against the same LDAP account and mailbox.

Additional context

No response

Source: mailcow/mailcow-dockerized