Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 3.0.1 (unreleased)

### Feature

- Add a Microsoft 365 (OAuth) mail transport: set the application (client) ID, tenant ID and client secret in the mail control panel to send mail through the Microsoft Graph API with the client credentials flow instead of SMTP. Run `pnpm seed:upgrade` (upgrade 1019) @robgietema

### Internal

- Make `pnpm i18n` deterministic: sort the source files, so the context of a message that is in more than one file no longer depends on the order of glob, and keep the existing translation of a message when its context changes @robgietema
Expand Down
42 changes: 42 additions & 0 deletions docs/admin-guide/mail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Mail
nav_order: 13
permalink: /admin-guide/mail
parent: Admin guide
---

# Mail

Nick sends mail (contact forms, notifications, content rules and password resets) using the settings of the `mail` control panel. There are two transports.

## SMTP

The default. Set the SMTP server, port, secure connection and, if needed, the user name and password.

## Microsoft 365 (OAuth)

Sends mail through the Microsoft Graph API using the client credentials flow, without a user name and password. Nick builds the full message (HTML, attachments, Bcc) and Graph sends it from a mailbox in your tenant.

### Set up the app registration

1. In the Microsoft Entra admin center, create an app registration (_App registrations_, _New registration_).
2. Under _API permissions_, add the Microsoft Graph _application_ permission `Mail.Send` and grant admin consent.
3. Under _Certificates & secrets_, create a client secret and copy its value.
4. From the overview page, copy the _Application (client) ID_ and the _Directory (tenant) ID_.

`Mail.Send` allows the app to send as any mailbox in the tenant. To limit it to the mailbox of the site, create an [application access policy](https://learn.microsoft.com/en-us/graph/auth-limit-mailbox-access) in Exchange Online.

### Configure Nick

In the mail control panel (_Site Setup_, _Mail_):

- Set _Mail transport_ to _Microsoft 365 (OAuth)_.
- On the _Microsoft 365 (OAuth)_ tab, fill in the _Application (client) ID_, _Tenant ID_ and _Client secret_. The secret is never returned by the API; leave it empty to keep the stored value.
- Set the _Site 'From' address_ to the mailbox that sends the mail. It has to be a user or shared mailbox in the tenant.
- Turn off _Debug_, otherwise the mail goes to the test server.

Access tokens are cached in memory until shortly before they expire.

### Upgrading

Existing sites get the new fields with `pnpm seed:upgrade` (upgrade 1019). The transport is set to SMTP, so nothing changes until you switch it.
35 changes: 34 additions & 1 deletion docs/rest-api/endpoints/examples/controlpanels/get.res
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Content-Type: application/json
"debug": true,
"secure": true,
"email_from_name": "Webmaster",
"email_from_address": "webmaster@plone.org"
"email_from_address": "webmaster@plone.org",
"transport": "smtp"
},
"schema": {
"required": ["host", "port", "email_from_name", "email_from_address"],
Expand All @@ -22,6 +23,7 @@ Content-Type: application/json
"id": "default",
"title": "Default",
"fields": [
"transport",
"host",
"port",
"secure",
Expand All @@ -31,6 +33,11 @@ Content-Type: application/json
"email_from_address",
"debug"
]
},
{
"id": "oauth",
"title": "Microsoft 365 (OAuth)",
"fields": ["oauth_client_id", "oauth_tenant_id", "oauth_client_secret"]
}
],
"properties": {
Expand Down Expand Up @@ -76,6 +83,32 @@ Content-Type: application/json
"type": "string",
"title": "Site 'From' address",
"description": "Nick generates email using this address as the email return address. It is also used as the destination address for the site-wide contact form and the “Send test email” feature."
},
"transport": {
"type": "string",
"title": "Mail transport",
"default": "smtp",
"choices": [
["smtp", "SMTP"],
["microsoft365", "Microsoft 365 (OAuth)"]
],
"description": "How the mail is sent: through an SMTP server, or through Microsoft 365 using OAuth (set the application details on the Microsoft 365 tab)."
},
"oauth_client_id": {
"type": "string",
"title": "Application (client) ID",
"description": "The application (client) ID of the app registration in Microsoft Entra ID. Used when the mail transport is Microsoft 365."
},
"oauth_tenant_id": {
"type": "string",
"title": "Tenant ID",
"description": "The directory (tenant) ID of your Microsoft 365 tenant."
},
"oauth_client_secret": {
"type": "string",
"title": "Client secret",
"widget": "password",
"description": "The client secret value of the app registration. The app needs the Mail.Send application permission, and the mail is sent from the site 'From' address, which must be a mailbox in the tenant."
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion locales/af.json

Large diffs are not rendered by default.

112 changes: 96 additions & 16 deletions locales/af/LC_MESSAGES/nick.po
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ msgctxt "Profiles|Core|Roles"
msgid "Anonymous"
msgstr "Anoniem"

#. Default: "Application (client) ID"
#: src/profiles/core/controlpanels/mail.json:83
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:83
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "Application (client) ID"
msgstr ""

#. Default: "Apply only to a objects in a particular workflow state"
#: src/content_rules/conditions/workflow_state.ts:12
msgctxt "Content rules|Conditions|Workflow state"
Expand Down Expand Up @@ -471,6 +478,13 @@ msgctxt "Profiles|Core|Behaviors|Versioning"
msgid "Change Note"
msgstr "Wysigingsnota"

#. Default: "Client secret"
#: src/profiles/core/controlpanels/mail.json:93
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:93
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "Client secret"
msgstr ""

#. Default: "Client/server ordering mismatch."
#: src/routes/content/content.ts:1160
msgctxt "Routes|Content"
Expand Down Expand Up @@ -649,7 +663,8 @@ msgid "Dates"
msgstr "Datums"

#. Default: "Debug"
#: src/profiles/core/controlpanels/mail.json:57
#: src/profiles/core/controlpanels/mail.json:73
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:73
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "Debug"
msgstr "Ontfout"
Expand Down Expand Up @@ -838,13 +853,15 @@ msgid "Dublin Core metadata"
msgstr "Dublin Core-metadata"

#. Default: "ESMTP password"
#: src/profiles/core/controlpanels/mail.json:40
#: src/profiles/core/controlpanels/mail.json:56
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:56
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "ESMTP password"
msgstr "ESMTP-wagwoord"

#. Default: "ESMTP username"
#: src/profiles/core/controlpanels/mail.json:52
#: src/profiles/core/controlpanels/mail.json:68
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:68
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "ESMTP username"
msgstr "ESMTP-gebruikersnaam"
Expand Down Expand Up @@ -1179,20 +1196,29 @@ msgctxt "Constants|Userschema"
msgid "Home Page"
msgstr ""

#. Default: "How the mail is sent: through an SMTP server, or through Microsoft 365 using OAuth (set the application details on the Microsoft 365 tab)."
#: src/profiles/core/controlpanels/mail.json:31
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:31
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "How the mail is sent: through an SMTP server, or through Microsoft 365 using OAuth (set the application details on the Microsoft 365 tab)."
msgstr ""

#. Default: "Identifier"
#: src/profiles/core/behaviors/short_name.json:16
msgctxt "Profiles|Core|Behaviors|Short name"
msgid "Identifier"
msgstr "Identifiseerder"

#. Default: "If enabled, the mail is sent to a test server."
#: src/profiles/core/controlpanels/mail.json:58
#: src/profiles/core/controlpanels/mail.json:74
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:74
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "If enabled, the mail is sent to a test server."
msgstr "Indien geaktiveer, word die e-pos na 'n toetsbediener gestuur."

#. Default: "If enabled, the mail is sent using a secure connection."
#: src/profiles/core/controlpanels/mail.json:63
#: src/profiles/core/controlpanels/mail.json:79
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:79
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "If enabled, the mail is sent using a secure connection."
msgstr "Indien geaktiveer, word die e-pos met 'n veilige verbinding gestuur."
Expand Down Expand Up @@ -1487,6 +1513,7 @@ msgstr "Afmelding"

#. Default: "Mail"
#: src/profiles/core/controlpanels/mail.json:3
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:3
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "Mail"
msgstr "E-pos"
Expand All @@ -1498,6 +1525,13 @@ msgctxt "Profiles|Core|Controlpanels|Form"
msgid "Mail Template"
msgstr ""

#. Default: "Mail transport"
#: src/profiles/core/controlpanels/mail.json:30
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:30
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "Mail transport"
msgstr ""

#. Default: "Manage Preferences"
#: src/profiles/core/permissions.json:22
msgctxt "Profiles|Core|Permissions"
Expand Down Expand Up @@ -1579,6 +1613,13 @@ msgctxt "Content rules|Actions|Logger"
msgid "Message"
msgstr ""

#. Default: "Microsoft 365 (OAuth)"
#: src/profiles/core/controlpanels/mail.json:25
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:25
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "Microsoft 365 (OAuth)"
msgstr ""

#. Default: "Missing credentials"
#: src/routes/authentication/authentication.ts:66
msgctxt "Routes|Authentication"
Expand Down Expand Up @@ -1681,13 +1722,15 @@ msgid "News"
msgstr ""

#. Default: "Nick generates email using this address as the email return address. It is also used as the destination address for the site-wide contact form and the “Send test email” feature."
#: src/profiles/core/controlpanels/mail.json:25
#: src/profiles/core/controlpanels/mail.json:41
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:41
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "Nick generates email using this address as the email return address. It is also used as the destination address for the site-wide contact form and the “Send test email” feature."
msgstr ""

#. Default: "Nick generates email using this name as the email sender."
#: src/profiles/core/controlpanels/mail.json:30
#: src/profiles/core/controlpanels/mail.json:46
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:46
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "Nick generates email using this name as the email sender."
msgstr ""
Expand Down Expand Up @@ -2315,13 +2358,15 @@ msgid "Rules"
msgstr "Reëls"

#. Default: "SMTP port"
#: src/profiles/core/controlpanels/mail.json:46
#: src/profiles/core/controlpanels/mail.json:62
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:62
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "SMTP port"
msgstr "SMTP-poort"

#. Default: "SMTP server"
#: src/profiles/core/controlpanels/mail.json:34
#: src/profiles/core/controlpanels/mail.json:50
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:50
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "SMTP server"
msgstr "SMTP-bediener"
Expand All @@ -2345,7 +2390,8 @@ msgid "Searchable text"
msgstr "Soekbare teks"

#. Default: "Secure"
#: src/profiles/core/controlpanels/mail.json:62
#: src/profiles/core/controlpanels/mail.json:78
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:78
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "Secure"
msgstr "Veilig"
Expand Down Expand Up @@ -2457,13 +2503,15 @@ msgid "Site"
msgstr "Webwerf"

#. Default: "Site 'From' address"
#: src/profiles/core/controlpanels/mail.json:24
#: src/profiles/core/controlpanels/mail.json:40
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:40
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "Site 'From' address"
msgstr "Webwerf 'Van'-adres"

#. Default: "Site 'From' name"
#: src/profiles/core/controlpanels/mail.json:29
#: src/profiles/core/controlpanels/mail.json:45
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:45
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "Site 'From' name"
msgstr "Webwerf 'Van'-naam"
Expand Down Expand Up @@ -2625,6 +2673,13 @@ msgctxt "Routes|Recyclebin"
msgid "Target path not found."
msgstr ""

#. Default: "Tenant ID"
#: src/profiles/core/controlpanels/mail.json:88
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:88
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "Tenant ID"
msgstr ""

#. Default: "Text is required to add a comment."
#: src/routes/comments/comments.ts:121
#: src/routes/comments/comments.ts:181
Expand Down Expand Up @@ -2669,11 +2724,26 @@ msgid "The URL for your external home page, if you have one."
msgstr ""

#. Default: "The address of your local SMTP (outgoing email) server. Usually 'localhost', unless you use an external server to send email."
#: src/profiles/core/controlpanels/mail.json:35
#: src/profiles/core/controlpanels/mail.json:51
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:51
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "The address of your local SMTP (outgoing email) server. Usually 'localhost', unless you use an external server to send email."
msgstr "Die adres van u plaaslike SMTP (uitgaande e-pos) bediener. Gewoonlik 'localhost', tensy u 'n eksterne bediener gebruik om e-pos te stuur."

#. Default: "The application (client) ID of the app registration in Microsoft Entra ID. Used when the mail transport is Microsoft 365."
#: src/profiles/core/controlpanels/mail.json:84
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:84
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "The application (client) ID of the app registration in Microsoft Entra ID. Used when the mail transport is Microsoft 365."
msgstr ""

#. Default: "The client secret value of the app registration. The app needs the Mail.Send application permission, and the mail is sent from the site 'From' address, which must be a mailbox in the tenant."
#: src/profiles/core/controlpanels/mail.json:94
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:94
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "The client secret value of the app registration. The app needs the Mail.Send application permission, and the mail is sent from the site 'From' address, which must be a mailbox in the tenant."
msgstr ""

#. Default: "The comment added to the history while versioning the content."
#: src/content_rules/actions/version_item.ts:30
msgctxt "Content rules|Actions|Version item"
Expand Down Expand Up @@ -2721,6 +2791,13 @@ msgctxt "Routes|Content"
msgid "The delta has to be top, bottom or an integer."
msgstr ""

#. Default: "The directory (tenant) ID of your Microsoft 365 tenant."
#: src/profiles/core/controlpanels/mail.json:89
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:89
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "The directory (tenant) ID of your Microsoft 365 tenant."
msgstr ""

#. Default: "The email address that sends the email. If no email is provided here, it will use the portal from address."
#: src/content_rules/actions/send_email.ts:56
msgctxt "Content rules|Actions|Send email"
Expand Down Expand Up @@ -2832,7 +2909,8 @@ msgid "The order of an item in its parent folder"
msgstr "Die volgorde van 'n item in sy ouergids"

#. Default: "The password for the ESMTP user account."
#: src/profiles/core/controlpanels/mail.json:41
#: src/profiles/core/controlpanels/mail.json:57
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:57
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "The password for the ESMTP user account."
msgstr "Die wagwoord vir die ESMTP-gebruikersrekening."
Expand All @@ -2844,7 +2922,8 @@ msgid "The person that created an item"
msgstr "Die persoon wat 'n item geskep het"

#. Default: "The port of your local SMTP (outgoing email) server. Usually '25'."
#: src/profiles/core/controlpanels/mail.json:47
#: src/profiles/core/controlpanels/mail.json:63
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:63
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "The port of your local SMTP (outgoing email) server. Usually '25'."
msgstr "Die poort van u plaaslike SMTP (uitgaande e-pos) bediener. Gewoonlik '25'."
Expand Down Expand Up @@ -3178,7 +3257,8 @@ msgid "Username"
msgstr ""

#. Default: "Username for authentication to your email server. Not required unless you are using ESMTP."
#: src/profiles/core/controlpanels/mail.json:53
#: src/profiles/core/controlpanels/mail.json:69
#: src/profiles/core/upgrades/1019/controlpanels/mail.json:69
msgctxt "Profiles|Core|Controlpanels|Mail"
msgid "Username for authentication to your email server. Not required unless you are using ESMTP."
msgstr "Gebruikersnaam vir verifikasie by u e-posbediener. Nie nodig tensy u ESMTP gebruik nie."
Expand Down
2 changes: 1 addition & 1 deletion locales/ar.json

Large diffs are not rendered by default.

Loading
Loading