Issue Description
A mailing list principal [email protected] has several members. Our submission sender rule allows list members to send as the list address, which is a common setup for team and role addresses.
Over SMTP submission a member can send as [email protected] without problems. Over JMAP (webmail client Bulwark), creating an identity with the same address is rejected. So the two submission paths disagree about which addresses a user may send from.
As far as I can tell, crates/jmap/src/identity/set.rs checks the identity email only against account_info.addresses(), i.e. the account’s own addresses. Lists the account belongs to are not considered, although the sender check accepts them.
Impact: the only option left for JMAP clients is to keep the personal identity and override From:. The envelope sender then is the member’s personal address. It ends up in the recipient’s Return-Path, so every mail sent on behalf of the team exposes the individual’s address. That is exactly what a role address is meant to avoid.
Expected Behavior
Identity/set accepts the addresses of lists (and groups) the account is a member of, i.e. the same addresses SMTP submission lets the user send from.
Actual Behavior
Identity/set returns notCreated with invalidProperties on “email”: “E-mail address not configured for this account.” SMTP submission with the same address is accepted.
Reproduction Steps
- Create a list principal [email protected] with user A as a member.
- Allow list members to send as the list address in the submission sender rule.
- As user A, send as [email protected] via SMTP submission: accepted.
- As user A, call Identity/set with email = [email protected]: rejected with “E-mail address not configured for this account.”
Relevant Log Output
"notCreated": {
"<id>": {
"type": "invalidProperties",
"properties": ["email"],
"description": "E-mail address not configured for this account."
}
}
Stalwart Version
v0.16.x
Installation Method
Binary (Linux)
Database Backend
RocksDB
Blob Storage
RocksDB
Search Engine
Internal
Directory Backend
Internal
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
This confirms authenticated_emails() ultimately uses account_info.addresses(), same as Identity/set. So SMTP mail_from check calls .addresses() on an AccountInfo type set via data.authenticated_as. Let’s check if it’s the same account_info() built via build_account_info that includes group/list membership.
I’ve gathered enough. Let me verify the submission sender-check mechanism references “group” membership (i.e., account.id_member_of which includes groups, not mailing lists) to confirm that the “sender rule allows list members” in the bug report actually works through authenticated_emails() / group membership addresses, distinct from what identity/set.rs checks.
Your reading of the code is correct, and this is a real discrepancy, not something intentionally documented.
What is actually happening:
Identity/set (crates/jmap/src/identity/set.rs) validates the email property against account_info.addresses(), built by build_account_info() in crates/common/src/cache/principals.rs. That function only collects the account’s own addresses plus the addresses of groups the account belongs to via id_member_of (i.e. Account::Group principals referenced through memberGroupIds).
- Mailing lists are a separate principal type (
MailingList, with a recipients map), not a Group. Membership in a mailing list’s recipients list does not populate id_member_of, so a list’s address never appears in account_info.addresses() for its members.
- SMTP submission’s sender check (
crates/smtp/src/inbound/mail.rs) uses mustMatchSender (an Expression, see MtaStageAuth.mustMatchSender in the docs), which is fully customizable and can be configured to allow additional senders, including mailing-list membership, via arbitrary expression logic. That is independent of the account_info.addresses() list used by Identity/set.
So the two code paths use different authorization mechanisms: one is a configurable expression (SMTP), the other is a hardcoded check against group-derived addresses only (JMAP Identity). Identity/set currently has no way to know about mailing-list membership or about whatever custom logic is embedded in a site’s mustMatchSender expression, so it rejects addresses that the SMTP path would accept under a customized sender rule.
This isn’t covered in the current docs. A community member or staff member will follow up.
This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.
For a role address the team sends from, make it a group. Identity/set already accepts the addresses of every group the account is a member of, and the default sender check allows the same set, so with sales@ as a group containing the team you can drop the custom sender rule and both paths agree. The envelope sender and Return-Path then become sales@ as well.
A mailing list is a distribution address: anyone can post to it, and receiving its mail doesn’t make you a member in the account sense. The custom expression you wrote applies to SMTP MAIL FROM only, and Identity/set doesn’t evaluate it, which is where the two paths split.
Thanks for the explanation. A group doesn’t work for our case though: as far as I can see, mail to a group lands in the group’s own shared mailbox, while a mailing list expands to the members and every member gets a copy in their own inbox. The copy per member is exactly why we use a list for the role address.
This is also how users know it from Exchange/Outlook: a distribution group delivers to every member, and admins can grant individual members “Send As” on the distribution group (Add-RecipientPermission … -AccessRights SendAs), separate from any shared mailbox. Users then just pick the group address in the From field.
The same gap exists for sub-addressing. We hand out per-purpose addresses (shop.user@domain via a custom subAddressing rule, the same idea as user+shop@domain) to keep the main address out of spam lists and to see who leaked it. Sometimes you have to answer from such an address. SMTP submission allows it with mustMatchSender, but Identity/set only accepts the account’s stored addresses, so in a JMAP client the reply goes out from the main address and gives it away.
So what we’re missing is a way to send as these addresses from JMAP clients without exposing the personal address in From or Return-Path. Could Identity/set accept the addresses the user is allowed to send from (for example by evaluating mustMatchSender, or by per-list and sub-addressing options)? That would also make JMAP and SMTP submission agree.
That makes sense: a group gives you the shared mailbox and the send rights, and a list gives you a copy in every inbox, and you need both on one address. Identity/set in 1.0 still accepts only the account’s own addresses and those of the groups it belongs to; it doesn’t evaluate the sender expression, and list membership and sub-addresses aren’t part of that set.
Letting identities follow what submission allows (Send As on lists, replying from a sub-address) is a feature request. Could you open it in Feature Ideas (Feature Ideas - Stalwart Support) with the Exchange comparison and the sub-addressing case? Both use cases are clear from what you wrote here.