nextcloud / mail

💌 Mail app for Nextcloud
https://apps.nextcloud.com/apps/mail
GNU Affero General Public License v3.0
848 stars 262 forks source link

Account/mailbox delegation #7723

Closed miaulalala closed 1 year ago

miaulalala commented 1 year ago

Is your feature request related to a problem? Please describe.

As shared mailboxes are often used for cases such as support or contact mailboxes, a user might not want to expose their private email address when sending an email from that mailbox.

Describe the solution you'd like

Case A - not everyone needs to see sent replies

Add an alias for the shared mailbox email address and allow it to be selected from the alias dropdown. This could also include fancy stuff like having the Display Name still set to the current user but still having the shared email address as the FROM email address.

Case B - everyone should see the sent replies

Admins or users should be able to set a custom "sent" mailbox. I don't think it's neccessary or even possible for this mailbox to be a special use mailbox "\SENT".

This custom "sent" mailbox will need to be a shared mailbox and the sending user needs ACL permissions lrwip on the custom "sent" mailbox.

Describe alternatives you've considered

If it isn't possible to send from alternative senders in Horde, allow setting the Reply-To header to the shared mailbox email address - either by handling a sending fail and resending the email automatically in the backend, or by allowing the user to have a "FROM - REPLY-TO" configuration stored.

Additional context

https://github.com/nextcloud/mail/issues/7057

Outlook 365 by default has no shared sent mailbox but needs to be set up specifically: https://learn.microsoft.com/en-us/microsoft-365/admin/email/configure-a-shared-mailbox?view=o365-worldwide#allow-everyone-to-see-the-sent-email-the-replies

Investigative findings

Delegation can mean many things:

Implementation ideas

For admins

For users

Work packages

ChristophWurst commented 1 year ago

Bildschirmfoto vom 2022-12-06 10-45-13

Sogo can do it.

There is also a setting in mailcow

Bildschirmfoto vom 2022-12-06 10-41-10

miaulalala commented 1 year ago

Gmail: https://support.google.com/mail/answer/138350?hl=en#zippy=%2Cadd-a-delegate

From the rfc:

Shared Namespace: A namespace that consists of mailboxes that are intended to be shared amongst users and do not exist within a user's Personal Namespace.

5.1.2.2. Common Namespace Models The previous version of this protocol did not define a default server namespace. Two common namespace models have evolved:

The "Personal Mailbox" model, in which the default namespace that is presented consists of only the user's personal mailboxes. To access shared mailboxes, the user must use an escape mechanism to reach another namespace.

The "Complete Hierarchy" model, in which the default namespace that is presented includes the user's personal mailboxes along with any other mailboxes they have access to.


Sogo mail response to a page load:

{
    "quotas": {
        "maxQuota": "3145728",
        "usedSpace": "69"
    },
    "mailboxes": [
        {
            "children": [
                {
                    "children": [],
                    "flags": [],
                    "subscribed": 0,
                    "type": "folder",
                    "sievePath": "INBOX/private - stay away!!!",
                    "name": "private - stay away!!!",
                    "path": "INBOX/private - stay away!!!"
                }
            ],
            "flags": [
                "haschildren"
            ],
            "subscribed": 0,
            "type": "inbox",
            "sievePath": "INBOX",
            "name": "INBOX",
            "path": "INBOX"
        },
        {
            "children": [],
            "flags": [
                "hasnochildren",
                "unmarked",
                "drafts"
            ],
            "subscribed": 0,
            "type": "draft",
            "sievePath": "Drafts",
            "name": "Drafts",
            "path": "Drafts"
        },
        {
            "children": [],
            "flags": [
                "hasnochildren",
                "unmarked",
                "sent"
            ],
            "subscribed": 0,
            "type": "sent",
            "sievePath": "Sent",
            "name": "Sent",
            "path": "Sent"
        },
        {
            "children": [],
            "flags": [
                "haschildren",
                "unmarked",
                "trash"
            ],
            "subscribed": 0,
            "type": "trash",
            "sievePath": "Trash",
            "name": "Trash",
            "path": "Trash"
        },
        {
            "children": [],
            "flags": [
                "hasnochildren",
                "unmarked",
                "junk"
            ],
            "subscribed": 0,
            "type": "junk",
            "sievePath": "Junk",
            "name": "Junk",
            "path": "Junk"
        },
        {
            "children": [],
            "flags": [],
            "subscribed": 0,
            "type": "templates",
            "sievePath": "Templates",
            "name": "Templates",
            "path": "Templates"
        },
        {
            "children": [],
            "flags": [
                "hasnochildren",
                "unmarked",
                "archive"
            ],
            "subscribed": 0,
            "type": "folder",
            "sievePath": "Archive",
            "name": "Archive",
            "path": "Archive"
        },
        {
            "children": [
                {
                    "children": [
                        {
                            "children": [
                                {
                                    "children": [],
                                    "flags": [],
                                    "subscribed": 0,
                                    "type": "folder",
                                    "sievePath": "Shared/nctest1@bitgrid.net/Read-only/kesselb was here ;)",
                                    "name": "kesselb was here ;)",
                                    "path": "Shared/nctest1@bitgrid.net/Read-only/kesselb was here ;)"
                                }
                            ],
                            "flags": [],
                            "subscribed": 0,
                            "type": "folder",
                            "sievePath": "Shared/nctest1@bitgrid.net/Read-only",
                            "name": "Read-only",
                            "path": "Shared/nctest1@bitgrid.net/Read-only"
                        },
                        {
                            "children": [],
                            "flags": [],
                            "subscribed": 0,
                            "type": "folder",
                            "sievePath": "Shared/nctest1@bitgrid.net/Read-write",
                            "name": "Read-write",
                            "path": "Shared/nctest1@bitgrid.net/Read-write"
                        },
                        {
                            "children": [
                                {
                                    "children": [],
                                    "flags": [],
                                    "subscribed": 0,
                                    "type": "folder",
                                    "sievePath": "Shared/nctest1@bitgrid.net/Trash/Sharing",
                                    "name": "Sharing",
                                    "path": "Shared/nctest1@bitgrid.net/Trash/Sharing"
                                }
                            ],
                            "flags": [
                                "noselect"
                            ],
                            "subscribed": 0,
                            "type": "additional",
                            "sievePath": "Shared/nctest1@bitgrid.net/Trash",
                            "name": "Trash",
                            "path": "Shared/nctest1@bitgrid.net/Trash"
                        }
                    ],
                    "flags": [],
                    "subscribed": 0,
                    "type": "folder",
                    "sievePath": "Shared/nctest1@bitgrid.net",
                    "name": "nctest1",
                    "path": "Shared/nctest1@bitgrid.net"
                }
            ],
            "flags": [],
            "subscribed": 0,
            "type": "otherUsers",
            "sievePath": "Shared",
            "name": "Other Users",
            "path": "Shared"
        }
    ]
}
miaulalala commented 1 year ago

send request in sogo (user nctest2 with delegation from nctest1):

{
    "to": [
        "xxxxxxxx@gmail.com"
    ],
    "cc": [],
    "bcc": [],
    "isHTML": 1,
    "text": "Rwa",
    "from": "nctest1 <nctest1@bitgrid.net>",
    "locale": "en",
    "subject": "Test"
}

With delegation I see all aliases of the delegating user in the delegated to user. An example: nctest1 delegates to nctest2 nctest2 shows all aliases for nctest1 in the dropdown for the "From:" address.

miaulalala commented 1 year ago

https://www.fastmail.help/hc/en-us/articles/1500000280401-Identities

miaulalala commented 1 year ago

https://serverfault.com/questions/948362/postfix-multiple-smtpd-sender-login-maps

miaulalala commented 1 year ago

http://www.postfix.org/postconf.5.html#smtpd_sender_login_maps

ChristophWurst commented 1 year ago

Moving from target Nextcloud 26 to 27

ChristophWurst commented 1 year ago

Tested account delegation on two accounts on mailcow.

1) Account 1 was configured to be allowed to send as account 2. 2) I set up account 1 in Mail 3) I added an alias for account 2's email to account 1 4) I sent an email from account but select the account 2 alias as sender

Message is sent as if account 2 sent it :heavy_check_mark:

ChristophWurst commented 1 year ago

Phrazed differently: it works with existing features. There are certainly setups where the alias should come automagically but a manual setup is possible today. We will document the steps and limitations.

nielsranosch commented 1 year ago

Thank you for documenting the delegation with mail server. Unfortunately, the mail server we use does not support delegation, and - in my estimation - most small mail providers will not support it. And even if it did, I think there is still a gap: A group mailbox. I think a mailbox that is assigned to a group (in Nextcloud) would be a good option to kill two birds with one stone: both non-personal mailboxes (NPMs) and mailbox delegation could be covered with it.

Would you be open to adding a "group mailbox" feature to the backlog?