stalwartlabs / mail-server

Secure & Modern All-in-One Mail Server (IMAP, JMAP, POP3, SMTP)
https://stalw.art
3.55k stars 136 forks source link

[bug]: Subscribing shared mailboxes doesn't work #251

Open rad4day opened 4 months ago

rad4day commented 4 months ago

What happened?

Upon subscribing a mailbox assigned to a group, the mailbox is not marked as is_subscribed. Evolution "forgets" the mailbox upon restart, Roundcube will not show it in the list of subscribed mailboxes. The crates/imap/op/list.rs code iterates over the mailbox as is_subscribed=false.

This issue has been mentioned on discord.

How can we reproduce the problem?

I can reproduce the problem by doing the following steps:

  1. Create a user account
  2. Create a group
  3. Assign user to group
  4. assign a mail address to group

  5. Try to subscribe to the group mail's inbox.
  6. The inbox is not marked as subscribed upon refresh (roundcube).

Version

v0.5.x

What database are you using?

PostgreSQL

What blob storage are you using?

PostgreSQL

Where is your directory located?

SQL

What operating system are you using?

Linux

Relevant log output

SUBSCRIBING: 

2024-02-10T12:57:36.273151Z TRACE store::dispatch::lookup: context="store" event="query" query="SELECT address FROM emails WHERE name = $1 AND type != 'list' ORDER BY type DESC, address ASC" result=Ok(Rows { rows: [Row { values: [<Text("censored@example.com")>] }] })
2024-02-10T12:57:36.289268Z TRACE store::dispatch::lookup: context="store" event="query" query="SELECT name, type, secret, description, quota FROM accounts WHERE name = $1 AND active = true" result=Ok(NamedRows { names: ["name", "type", "secret", "description", "quota"], rows: [Row { values: [Text("postmaster"), Text("group"), Null, Text("GRP_postmaster"), Integer(0)] }] })
2024-02-10T12:57:36.290743Z TRACE store::dispatch::lookup: context="store" event="query" query="SELECT address FROM emails WHERE name = $1 AND type != 'list' ORDER BY type DESC, address ASC" result=Ok(Rows { rows: [Row { values: [<Text("censored@example.com")>] }] })
2024-02-10T12:57:36.307622Z TRACE session{instance="imap" protocol=Imap remote.ip="<censored>" remote.port=12480}: imap::core::session: event="write" data="A0003 OK [CAPABILITY IMAP4rev2 IMAP4rev1 ENABLE SASL-IR LITERAL+ ID UTF8=ACCEPT IDLE NAMESPACE CHILDREN MULTIAPPEND BINARY UNSELECT ACL UIDPLUS ESEARCH WITHIN SEARCHRES SORT THREAD=REFERENCES LIST-EXTENDED ESORT SORT=DISPLAY SPECIAL-USE CREATE-SPECIAL-USE MOVE CONDSTORE QRESYNC UNAUTHENTICATE STATUS=SIZE OBJECTID PREVIEW] Authentication successful\r\n" size=351

2024-02-10T12:57:36.346614Z TRACE session{instance="imap" protocol=Imap remote.ip="<censored>" remote.port=12480}: imap::core::client: event="read" data="A0004 SUBSCRIBE \"Shared Folders/postmaster/Inbox\"\r\n" size=51
2024-02-10T12:57:36.351610Z TRACE session{instance="imap" protocol=Imap remote.ip="<censored>" remote.port=12480}: imap::core::session: event="write" data="A0004 OK Mailbox subscribed.\r\n" size=30

2024-02-10T12:57:36.389709Z TRACE session{instance="imap" protocol=Imap remote.ip="<censored>" remote.port=12480}: imap::core::client: event="read" data="A0005 LOGOUT\r\n" size=14
2024-02-10T12:57:36.390295Z TRACE session{instance="imap" protocol=Imap remote.ip="<censored>" remote.port=12480}: imap::core::session: event="write" data="* BYE Stalwart IMAP4rev2 v0.5.3 bids you farewell.\r\nA0005 OK LOGOUT completed\r\n" size=79
2024-02-10T12:57:36.390770Z DEBUG session{instance="imap" protocol=Imap remote.ip="<censored>" remote.port=12480}: imap::core::session: Disconnecting client. event="disconnect"

----

RETRIEVING:

2024-02-10T12:58:57.366105Z TRACE session{instance="imap" protocol=Imap remote.ip="<censored>" remote.port=12510}: imap::core::client: event="read" data="A0004 LIST (SUBSCRIBED) \"\" \"*\"\r\n" size=32
2024-02-10T12:58:57.384609Z TRACE session{instance="imap" protocol=Imap remote.ip="<censored>" remote.port=12510}: imap::core::session: event="write" data="* LIST (\\Subscribed) \"/\" \"Junk Mail\"\r\n* LIST (\\Subscribed) \"/\" \"Sent Items\"\r\n* LIST (\\NoSelect) \"/\" \"Shared Folders\"\r\nA0004 OK LIST completed\r\n" size=143
2024-02-10T12:58:57.432528Z TRACE session{instance="imap" protocol=Imap remote.ip="<censored>" remote.port=12510}: imap::core::client: event="read" data="A0005 LOGOUT\r\n" size=14
2024-02-10T12:58:57.433583Z TRACE session{instance="imap" protocol=Imap remote.ip="<censored>" remote.port=12510}: imap::core::session: event="write" data="* BYE Stalwart IMAP4rev2 v0.5.3 bids you farewell.\r\nA0005 OK LOGOUT completed\r\n" size=79

Code of Conduct

violoncelloCH commented 1 month ago

I'm on v0.8.0 and Thunderbird won't even show me the mailboxes once. In the subscribe dialog I can select them (tick the checkmark or click the subscribe button), but when confirming with OK, the folders won't appear in the left side panel of Thunderbird.

Pieter-Antonio commented 9 hours ago

I had the same issue of Thunderbird not showing the shared mailbox. However, in the iOS mail client the shared mailbox did appear. Finally, I managed to fix the Thunderbird issue with the help of: https://support.mozilla.org/en-US/questions/1346193. The solution was to uncheck 'Show only subscribed folders' in the advanced server settings.

I do still have to problem of not being able to send from the shared address. Sending mail from the personal address, and its alias does work. This is the exact same issue as in #485