Aliases not working

Issue Description

I’m pretty sure this worked before, but now it’s not working:

My ldap filter for mailboxes and aliases is this:

(|(&(objectClass=postfixAlias)(postfixMailAlias=?)(status=TRUE))(&(objectClass=postfixMailBox)(postfixMailAddress=?)(status=TRUE)))

The ObjectClass postfixAlias has two attributes: postfixMailAlias and postfixMailAddress, which is the mailbox.

Even if I choose that the alias is on the postfixMailAddress, Stalwart returns mails sent to the alias.

It seems like a bug to me, when I tested this a few weeks ago, it worked.

Stalwart Version

v0.16.x

Installation Method

Docker

Database Backend

FoundationDB

Blob Storage

S3-compatible

Search Engine

Internal

Directory Backend

LDAP

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

Let me look into LDAP alias handling in Stalwart.

The key issue here is how Stalwart maps your custom LDAP schema to the concepts of “primary address” vs “alias”. Stalwart uses two separate attribute mappings:

  • attrEmail (default: ["mail"]) - the primary email address attribute
  • attrEmailAlias (default: ["mailAlias"]) - the alias attribute

Your postfixAlias entries use postfixMailAlias as the alias address and postfixMailAddress as the target mailbox. For Stalwart to correctly resolve these, you need to make sure your Directory object’s attribute mapping reflects your custom schema. Specifically, you likely need to configure:

{
  "@type": "Ldap",
  "attrEmail": ["postfixMailAddress"],
  "attrEmailAlias": ["postfixMailAlias"],
  "filterMailbox": "(|(&(objectClass=postfixAlias)(postfixMailAlias=?)(status=TRUE))(&(objectClass=postfixMailBox)(postfixMailAddress=?)(status=TRUE)))"
}

The critical part is that attrEmailAlias must point to the attribute holding the alias address (postfixMailAlias), and attrEmail must point to the attribute holding the primary/target address (postfixMailAddress). Stalwart uses these attribute mappings - not just the filter - to understand which address is the alias and which is the delivery target. If attrEmailAlias is still set to the default ["mailAlias"], Stalwart won’t recognize postfixMailAlias values as aliases even when your filter returns the entry.

You can verify and update these settings in the WebUI under your LDAP Directory object configuration.

Reference: LDAP Backend - Object attributes

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

I don’t think so - while it is logic that the `attrEmailAlias` should point to the alias, it never worked like this for me. My understanding is that the Mailbox filter finds the mailbox via the alias’ address, and find the mailbox the alias points to via the attribute pointing to the mailbox.

So I am not sure if the attrEmailAlias should point to the alias or to the mailbox. But once, when it was pointing to the mailbox, things worked. Now it doesn’t work neither way.