[GH-ISSUE #6911] [Feature]: One sub for multiple emails #4581

Open
opened 2026-10-31 20:40:39 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @X-Oracle on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6911

Hi @MHSanaei,

I hope you’re well.

I had been using version 2.9.4 until recently, when I upgraded to the latest version, It seems that a feature was removed to support allowing a single user to have multiple inbounds.

However, I can no longer use a single subscription for multiple email addresses. This means I have to create multiple subscriptions, which makes them harder to maintain.

Describe the solution you'd like

I can think of two possible solutions:

  1. Bring back the ability to assign the same subscription ID to multiple users, so the subscription aggregates them. This should be possible if the database key isn’t defined as unique.
  2. Add subscription ID support to the new group feature, which would better align with the new panel design.

Alternatives you've considered

No response

Concrete use case

No response

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

Subscription (share links / Clash / JSON), Frontend (UI / panel pages), Backend (API endpoints, login, settings)

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @X-Oracle on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6911 ### Is your feature request related to a problem? Hi @MHSanaei, I hope you’re well. I had been using version 2.9.4 until recently, when I upgraded to the latest version, It seems that a feature was removed to support allowing a single user to have multiple inbounds. However, I can no longer use a single subscription for multiple email addresses. This means I have to create multiple subscriptions, which makes them harder to maintain. ### Describe the solution you'd like I can think of two possible solutions: 1. Bring back the ability to assign the same subscription ID to multiple users, so the subscription aggregates them. This should be possible if the database key isn’t defined as unique. 2. Add subscription ID support to the new `group` feature, which would better align with the new panel design. ### Alternatives you've considered _No response_ ### Concrete use case _No response_ ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? Subscription (share links / Clash / JSON), Frontend (UI / panel pages), Backend (API endpoints, login, settings) ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [x] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 23, 2026):

This is a deliberate change in the panel, not an accidental removal. Since the client model became first-class, the panel rejects a subId that already belongs to another client. On the subscription side, though, a shared subId is still allowed and still aggregates, so restoring option 1 needs only the panel-side checks relaxed. Whether to do that is a product decision for the maintainer.

What the code does today

  • Creating a client with a subId owned by a different email is rejected in internal/web/service/client_crud.go:212-221:
    Where("sub_id = ? AND email <> ?", client.SubID, client.Email).
    ...
    return false, common.NewError("subId already in use:", client.SubID)
    
  • Editing a client's subId to one already in use is rejected in client_crud.go:689-698 ("Duplicate subId:"). Bulk add and import have the same check (client_bulk.go:1351, client_bulk.go:1435, client_portable.go:190).
  • This was introduced on purpose in 88a36773, "feat(clients): enforce unique subId per client like email" (first shipped in v3.2.5). Its message says: "The old multi-inbound model duplicated a client across inbounds sharing one subId, so this check was dropped; the first-class multi-client model makes per-client subId uniqueness correct again. Existing duplicates are left untouched; only new/edited duplicates are blocked."
  • The behaviour is pinned by TestClientUpdateDuplicateSubIDDoesNotRenameEmail in internal/web/service/client_update_rename_test.go:116.

Your option 1: the storage layer already supports it

  • The database column is only indexed, not unique: SubID string ... gorm:"index;column:sub_id" (internal/database/model/model.go:972). The code says so explicitly at internal/web/service/client_lookup.go:107: "sub_id carries a plain index, not a unique one: one subscription can cover several clients".
  • The subscription server still collects every client with the subId: getInboundsBySubId joins on clients.sub_id = ? (internal/sub/service.go:680-691), and indexStatsBySubId pulls all emails for that subId (service.go:710). TestClientUpdateKeepsSharedSubIDEditable (client_update_rename_test.go:148) checks that clients that already share a subId stay editable.
  • So shared subIds you migrated from 2.9.4 should still work as one aggregated subscription. Only creating new shared subIds is blocked, and that happens in the service checks above, not in the schema.

Your option 2: groups have no subscription today

ClientGroup (internal/database/model/model.go:1010-1017) has only Name, ResetUp and ResetDown. There is no subId and no subscription route for a group, so this would be new work: a schema migration, sub-server routing and UI.

What works right now

If one person needs several inbounds, the current model lets one client (one email, one subId) be attached to several inbounds at once. When you add or edit a client, select several inbounds; they are stored in client_inbounds. Its single subscription then returns links for all those inbounds. This covers the old "same subId on several emails" setup, unless you need separate traffic counters or limits per email. If that's your case, please say so, because it changes which of your two options fits.

Verdict: Feature request

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:6371385034 --> @github-actions[bot] commented on GitHub (Oct 23, 2026): This is a deliberate change in the panel, not an accidental removal. Since the client model became first-class, the panel rejects a subId that already belongs to another client. On the subscription side, though, a shared subId is still allowed and still aggregates, so restoring option 1 needs only the panel-side checks relaxed. Whether to do that is a product decision for the maintainer. **What the code does today** - Creating a client with a subId owned by a different email is rejected in `internal/web/service/client_crud.go:212-221`: ```go Where("sub_id = ? AND email <> ?", client.SubID, client.Email). ... return false, common.NewError("subId already in use:", client.SubID) ``` - Editing a client's subId to one already in use is rejected in `client_crud.go:689-698` (`"Duplicate subId:"`). Bulk add and import have the same check (`client_bulk.go:1351`, `client_bulk.go:1435`, `client_portable.go:190`). - This was introduced on purpose in 88a36773, *"feat(clients): enforce unique subId per client like email"* (first shipped in v3.2.5). Its message says: *"The old multi-inbound model duplicated a client across inbounds sharing one subId, so this check was dropped; the first-class multi-client model makes per-client subId uniqueness correct again. Existing duplicates are left untouched; only new/edited duplicates are blocked."* - The behaviour is pinned by `TestClientUpdateDuplicateSubIDDoesNotRenameEmail` in `internal/web/service/client_update_rename_test.go:116`. **Your option 1: the storage layer already supports it** - The database column is only indexed, not unique: `SubID string ... gorm:"index;column:sub_id"` (`internal/database/model/model.go:972`). The code says so explicitly at `internal/web/service/client_lookup.go:107`: *"sub_id carries a plain index, not a unique one: one subscription can cover several clients"*. - The subscription server still collects **every** client with the subId: `getInboundsBySubId` joins on `clients.sub_id = ?` (`internal/sub/service.go:680-691`), and `indexStatsBySubId` pulls all emails for that subId (`service.go:710`). `TestClientUpdateKeepsSharedSubIDEditable` (`client_update_rename_test.go:148`) checks that clients that already share a subId stay editable. - So shared subIds you migrated from 2.9.4 should still work as one aggregated subscription. Only creating new shared subIds is blocked, and that happens in the service checks above, not in the schema. **Your option 2: groups have no subscription today** `ClientGroup` (`internal/database/model/model.go:1010-1017`) has only `Name`, `ResetUp` and `ResetDown`. There is no subId and no subscription route for a group, so this would be new work: a schema migration, sub-server routing and UI. **What works right now** If one person needs several inbounds, the current model lets **one** client (one email, one subId) be attached to several inbounds at once. When you add or edit a client, select several inbounds; they are stored in `client_inbounds`. Its single subscription then returns links for all those inbounds. This covers the old "same subId on several emails" setup, unless you need *separate* traffic counters or limits per email. If that's your case, please say so, because it changes which of your two options fits. Verdict: Feature request _This reply was generated automatically; a maintainer may follow up._ <!-- claude-issue:analyst -->
Author
Owner

@X-Oracle commented on GitHub (Oct 23, 2026):

the use case is one person needs several emails for one inbound, each email routed through different outbound.

Person: Alex

Email1: US.Alex@Dir on inbound 1
Email2: DE.Alex@Dir on inbound 1
email3: US.Alex@CF on inbound 2
email4: DE.Alex@CF on inbound 2

subid: alex-sub

must be able to aggregate all of them

<!-- gh-comment-id:6371617959 --> @X-Oracle commented on GitHub (Oct 23, 2026): the use case is one person needs several emails for one inbound, each email routed through different outbound. Person: Alex Email1: US.Alex@Dir on inbound 1 Email2: DE.Alex@Dir on inbound 1 email3: US.Alex@CF on inbound 2 email4: DE.Alex@CF on inbound 2 subid: alex-sub must be able to aggregate all of them
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#4581
No description provided.