Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement]: implement special_use directory mapping #458

Closed
1 task done
mightyBroccoli opened this issue May 21, 2024 · 9 comments
Closed
1 task done

[enhancement]: implement special_use directory mapping #458

mightyBroccoli opened this issue May 21, 2024 · 9 comments
Labels
enhancement New feature or request

Comments

@mightyBroccoli
Copy link

Which feature or improvement would you like to request?

With dovecot it is possible to map multiple directory folders (Sent , Sent Objects, Gesendet ) to a single directory /Sent within the mailbox.
https://doc.dovecot.org/configuration_manual/namespace/#core_setting-namespace/mailbox/special_use
https://github.com/mailcow/mailcow-dockerized/blob/master/data/conf/dovecot/dovecot.folders.conf

Due to many clients having multiple defaults in which mailbox dir for example, sent items are stored.

Is your feature request related to a problem?

Kind of, while testing I noticed that Outlook / Thunderbird / Apple Mail all have different "default" names for folders inside the mailbox.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mightyBroccoli mightyBroccoli added the enhancement New feature or request label May 21, 2024
@mdecimus
Copy link
Member

Stalwart already advertises special use folders. When an account is created it automatically creates Inbox, Sent Items, Trash and Junk Mail folders with their respective special use flags.
It is also possible to create new special use folders by the client.

@mightyBroccoli
Copy link
Author

The main point of this feature request is to map multiple common names to a single folder. The small excerpt all writes to /Trash when the folder Trash, Deleted Messages, Deleted Items, Rubbish or Gelöschte Objekte is used.

  mailbox "Trash" {
    auto = subscribe
    special_use = \Trash
  }
  mailbox "Deleted Messages" {
    special_use = \Trash
  }
  mailbox "Deleted Items" {
    special_use = \Trash
  }
  mailbox "Rubbish" {
    special_use = \Trash
  }
  mailbox "Gelöschte Objekte" {
    special_use = \Trash
  }

This allows multiple clients to "use" different folders that internally all map to the same folder, keeping the mailbox clean. I used AppleMail Outlook and Thunderbird and have now Trash ( from Thunderbird ) , Gelöschte Objekts ( from Outlook ) and Deleted Messages ( from Apple Mail ) all with their respective set of deleted messages.

For Trash it is not really a "big" issue, but this also applies to Junk , Archives and so on.

@mdecimus
Copy link
Member

The problem I see is that JMAP requires each special use type (or role in JMAP terms) to be assigned to a single folder. So it won't be possible to have the \Trash special use flag in more than one mailbox.
What could be done is to assign \Trash to just one folder and treat all others folders as aliases. This will not solve the problem you are having as your mail clients will keep creating their own folders but at least all messages will go to the same place.

@mightyBroccoli
Copy link
Author

at least all messages will go to the same place

As this is the "main" issue I have with this behavior, I would think that this would still be beneficial to the server, and potentially it may be worth a consideration why jmap implements an imap feature and breaks it in the process.
I think it's funny that the rfc states Servers providing IMAP access to the same data are encouraged to enforce these extra restrictions in IMAP as well.

@mdecimus
Copy link
Member

In my opinion JMAP has fixed an IMAP issue. Roles should be unique per mailbox, I don't think it makes sense to have multiple folders with the \Trash or '\Sent` special-use role for instance.

IMAP clients should look for special-use folders by role rather than name and create these special-use folders if these don't exist already on the server.

@mightyBroccoli
Copy link
Author

mightyBroccoli commented May 29, 2024

True, but they don't, and they very certainly won't in the foreseeable future or even at all.
Sure it would be nice if every client does that but let's be honest, most clients won't. Thus people will end up with x different sent folders and that is annoying as f***.

JMAP will not work for people if it "break" all "not JMAP" clients by spamming folders. Requiring a change in such old standard will be difficult, I sense -> https://xkcd.com/927/

@nomadturk
Copy link

Well, also when you think about how many JMAP clients VS how many IMAP ones out there and how close are we to using JMAP in the near future....

@mdecimus
Copy link
Member

mdecimus commented Jun 6, 2024

This was implemented but should be used with caution as it is not only incompatible with JMAP but also RFC 8474 - IMAP Extension for Object Identifiers.
For example, mapping Trash to Deleted Items will return the real MAILBOXID of Trash when the folder is created but once selected the MAILBOXID returned belongs to Deleted Items:

a create Trash
a OK [MAILBOXID (jeaaaabm)] Mailbox created.
a select "Trash"
* 0 EXISTS
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* 0 RECENT
* OK [PERMANENTFLAGS (\Deleted \Seen \Answered \Flagged \Draft \*)] All allowed
* OK [UIDVALIDITY 2197339414] UIDs valid
* OK [UIDNEXT 1] Next predicted UID
* OK [MAILBOXID (jeaaaaab)] Unique Mailbox ID
a OK [READ-WRITE] SELECT completed

This feature will also create issues deleting folder aliases to certain special folders such as Deleted Items and Junk Mail which Stalwart does not allow to be deleted.

In other words, personally I think this feature is a hack to support broken email clients. If a mail client does not allow to configure the name of special use folders and instead insists on creating their own, then this is a bug that should be fixed on the client side.

@mdecimus mdecimus closed this as completed Jun 6, 2024
@mightyBroccoli
Copy link
Author

I actually am not sure that this constitutes as implemented.

If the implementation breaks JMAP and potentially hinders other IMAP clients, then this fix should not be released.

I would call that a lose lose with the potential to implement one IMAP special case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants