@nxgt/mail-presets 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,337 @@
1
+ # The e-mails
2
+
3
+ This page is for sending one of the nine presets, or rewording it: what each
4
+ one is for, what it shows, the placeholders the sender fills, its subject,
5
+ and every message it uses in `en` and `fr`.
6
+
7
+ Every preset is built from your `ui()` brand and theme. The built HTML of
8
+ each, with the brand `Acme`, is in
9
+ [`samples/`](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/README.md).
10
+
11
+ ```ts
12
+ // maizzle.config.ts — the one that built the samples
13
+ import { defineMailConfig } from '@nxgt/mail-config';
14
+ import { i18n } from '@nxgt/mail-i18n';
15
+ import { presets } from '@nxgt/mail-presets';
16
+ import { ui, uiCatalogues } from '@nxgt/mail-ui';
17
+
18
+ const mails = presets();
19
+
20
+ export default defineMailConfig({
21
+ plugins: [
22
+ ui({ brand: { name: 'Acme', url: 'https://acme.example' } }),
23
+ i18n({
24
+ locales: ['en', 'fr'],
25
+ catalogues: [uiCatalogues, mails.catalogues],
26
+ templates: [mails.templates],
27
+ }),
28
+ ],
29
+ });
30
+ ```
31
+
32
+ | E-mail | Sent when | Placeholders | A URL |
33
+ | --- | --- | --- | --- |
34
+ | [`verify-email`](#verify-email) | An address must be confirmed as the user's | `link`, `name` | `link` |
35
+ | [`reset-password`](#reset-password) | A user asked to reset their password | `link`, `name` | `link` |
36
+ | [`password-changed`](#password-changed) | A password was just changed | `link`, `name` | `link` |
37
+ | [`email-changed`](#email-changed) | An account's address was changed — sent to the former one | `link`, `name`, `newEmail` | `link` |
38
+ | [`sign-in-code`](#sign-in-code) | A user signs in with a one-time code | `code` | — |
39
+ | [`magic-link`](#magic-link) | A user signs in with a one-time link | `link` | `link` |
40
+ | [`new-sign-in`](#new-sign-in) | An account was signed in from a device not seen before | `device`, `link`, `location`, `name`, `time` | `link` |
41
+ | [`welcome`](#welcome) | An account was just created | `link`, `name` | `link` |
42
+ | [`invitation`](#invitation) | Someone invites the recipient to an organisation | `inviter`, `link`, `organization` | `link` |
43
+
44
+ The placeholders are the manifest's `variables`, and the URL ones its
45
+ `urlVariables`: the sender fills a URL one with an `http:` or `https:` URL,
46
+ and the others with text, which the renderer HTML-escapes. `{brand}` in a
47
+ message is not a placeholder: it is your `ui({ brand })` name, written at
48
+ build time.
49
+
50
+ ## What they share
51
+
52
+ Every preset is an `<NxLayout>`: the brand at the top, the content on a card,
53
+ and the footer's `common.footer.why`. Every one with a `link` shows it twice —
54
+ a button, then the URL itself under `presets.linkFallback`, for a mail client
55
+ that breaks the button.
56
+
57
+ The `fr` messages put a no-break space (U+00A0) before a colon, as French
58
+ typography does, so a line never starts with `:`. Keep it in a `fr` override.
59
+
60
+ | Key | `en` | `fr` | Used by |
61
+ | --- | --- | --- | --- |
62
+ | `presets.linkFallback` | If the button does not work, open this link: | Si le bouton ne fonctionne pas, ouvrez ce lien : | every preset with a `link` |
63
+ | `presets.notYou` | If this was not you, secure your account now. | Si ce n'était pas vous, sécurisez votre compte dès maintenant. | `password-changed`, `email-changed`, `new-sign-in` |
64
+ | `common.greeting` | Hello {name}, | Bonjour {name}, | every preset but `sign-in-code`, `magic-link` and `invitation` |
65
+ | `common.footer.ignore` | If you did not ask for this, you can ignore this e-mail. | Si vous n'êtes pas à l'origine de cette demande, vous pouvez ignorer cet e-mail. | `verify-email`, `reset-password`, `magic-link` |
66
+ | `common.footer.why` | You received this e-mail because you have an account with {brand}. | Vous recevez cet e-mail parce que vous avez un compte chez {brand}. | every preset, in the footer |
67
+
68
+ The `common` keys come from `@nxgt/mail-ui`'s `uiCatalogues`; see its
69
+ [Shared messages](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-ui/docs/guide/messages.md).
70
+ The `presets` keys come with every `presets()` answer, whatever `only` holds.
71
+
72
+ Each preset below has its own group, named after it (`verify-email` →
73
+ `verifyEmail`). `subject` is its subject; `preheader` is the line a mail
74
+ client shows after the subject in the inbox.
75
+
76
+ ## `verify-email`
77
+
78
+ <img src="https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/en/verify-email.png" width="420" alt="The verify-email e-mail, in English">
79
+
80
+ [In French](https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/fr/verify-email.png)
81
+
82
+ To confirm that an address belongs to the user, after they sign up or add
83
+ it. A title, the greeting, the body, the **Confirm my address** button, the
84
+ link as text, and `common.footer.ignore`.
85
+
86
+ | Key | `en` | `fr` |
87
+ | --- | --- | --- |
88
+ | `verifyEmail.subject` | Confirm your e-mail address | Confirmez votre adresse e-mail |
89
+ | `verifyEmail.preheader` | One click to confirm your address. | Un clic pour confirmer votre adresse. |
90
+ | `verifyEmail.title` | Confirm your e-mail address | Confirmez votre adresse e-mail |
91
+ | `verifyEmail.body` | Confirm that this address is yours to finish setting up your {brand} account. | Confirmez que cette adresse est bien la vôtre pour terminer la création de votre compte {brand}. |
92
+ | `verifyEmail.action` | Confirm my address | Confirmer mon adresse |
93
+
94
+ Placeholders: `name`, `link` (a URL). Samples:
95
+ [en](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/en/verify-email.html) ·
96
+ [fr](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/fr/verify-email.html).
97
+
98
+ ## `reset-password`
99
+
100
+ <img src="https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/en/reset-password.png" width="420" alt="The reset-password e-mail, in English">
101
+
102
+ [In French](https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/fr/reset-password.png)
103
+
104
+ To let a user choose a new password. A title, the greeting, the body, the
105
+ **Choose a new password** button, the link as text, and
106
+ `common.footer.ignore`.
107
+
108
+ | Key | `en` | `fr` |
109
+ | --- | --- | --- |
110
+ | `resetPassword.subject` | Reset your password | Réinitialisez votre mot de passe |
111
+ | `resetPassword.preheader` | Choose a new password for your account. | Choisissez un nouveau mot de passe pour votre compte. |
112
+ | `resetPassword.title` | Reset your password | Réinitialisez votre mot de passe |
113
+ | `resetPassword.body` | Someone asked to reset the password of your {brand} account. Choose a new one with the button below. | Quelqu'un a demandé à réinitialiser le mot de passe de votre compte {brand}. Choisissez-en un nouveau avec le bouton ci-dessous. |
114
+ | `resetPassword.action` | Choose a new password | Choisir un nouveau mot de passe |
115
+
116
+ Placeholders: `name`, `link` (a URL). Samples:
117
+ [en](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/en/reset-password.html) ·
118
+ [fr](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/fr/reset-password.html).
119
+
120
+ ## `password-changed`
121
+
122
+ <img src="https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/en/password-changed.png" width="420" alt="The password-changed e-mail, in English">
123
+
124
+ [In French](https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/fr/password-changed.png)
125
+
126
+ A notice, after the password of an account changed. A title, the greeting,
127
+ the body, a warning alert with `presets.notYou`, the **Secure my account**
128
+ button, and the link as text. `link` is where the user secures the account —
129
+ your recovery or account-settings page.
130
+
131
+ | Key | `en` | `fr` |
132
+ | --- | --- | --- |
133
+ | `passwordChanged.subject` | Your password was changed | Votre mot de passe a été modifié |
134
+ | `passwordChanged.preheader` | The password of your account was just changed. | Le mot de passe de votre compte vient d'être modifié. |
135
+ | `passwordChanged.title` | Your password was changed | Votre mot de passe a été modifié |
136
+ | `passwordChanged.body` | The password of your {brand} account was just changed. | Le mot de passe de votre compte {brand} vient d'être modifié. |
137
+ | `passwordChanged.action` | Secure my account | Sécuriser mon compte |
138
+
139
+ Placeholders: `name`, `link` (a URL). Samples:
140
+ [en](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/en/password-changed.html) ·
141
+ [fr](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/fr/password-changed.html).
142
+
143
+ ## `email-changed`
144
+
145
+ <img src="https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/en/email-changed.png" width="420" alt="The email-changed e-mail, in English">
146
+
147
+ [In French](https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/fr/email-changed.png)
148
+
149
+ A notice sent to the **former** address, after an account's address changed,
150
+ so its owner can undo a change they did not make. A title, the greeting, the
151
+ body naming the new address, a warning alert with `presets.notYou`, the
152
+ **Undo this change** button, and the link as text.
153
+
154
+ | Key | `en` | `fr` |
155
+ | --- | --- | --- |
156
+ | `emailChanged.subject` | Your e-mail address was changed | Votre adresse e-mail a été modifiée |
157
+ | `emailChanged.preheader` | Your account now signs in with a new address. | Votre compte utilise désormais une nouvelle adresse. |
158
+ | `emailChanged.title` | Your e-mail address was changed | Votre adresse e-mail a été modifiée |
159
+ | `emailChanged.body` | Your {brand} account now uses {newEmail}. We send this notice to your former address. | Votre compte {brand} utilise désormais {newEmail}. Nous envoyons cet avis à votre ancienne adresse. |
160
+ | `emailChanged.action` | Undo this change | Annuler ce changement |
161
+
162
+ Placeholders: `name`, `newEmail` (the new address, as text), `link` (a URL).
163
+ Samples:
164
+ [en](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/en/email-changed.html) ·
165
+ [fr](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/fr/email-changed.html).
166
+
167
+ ## `sign-in-code`
168
+
169
+ <img src="https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/en/sign-in-code.png" width="420" alt="The sign-in-code e-mail, in English">
170
+
171
+ [In French](https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/fr/sign-in-code.png)
172
+
173
+ A one-time code to type in, for a sign-in without a password or a second
174
+ factor. A title, the body, the code in a large block (`<NxCode>`), and
175
+ `signInCode.ignore`. No greeting and no link.
176
+
177
+ | Key | `en` | `fr` |
178
+ | --- | --- | --- |
179
+ | `signInCode.subject` | Your sign-in code: {code} | Votre code de connexion : {code} |
180
+ | `signInCode.preheader` | Enter this code to sign in. | Saisissez ce code pour vous connecter. |
181
+ | `signInCode.title` | Your sign-in code | Votre code de connexion |
182
+ | `signInCode.body` | Enter this code to sign in to {brand}. It works once. | Saisissez ce code pour vous connecter à {brand}. Il ne fonctionne qu'une fois. |
183
+ | `signInCode.ignore` | If you did not try to sign in, you can ignore this e-mail: no one can sign in without the code. | Si vous n'avez pas essayé de vous connecter, vous pouvez ignorer cet e-mail : personne ne peut se connecter sans ce code. |
184
+
185
+ Placeholders: `code`, in the body and **in the subject** — the manifest's
186
+ subject is `Your sign-in code: {{ code }}`, filled like the body, so the code
187
+ shows in an inbox's list. Write a `signInCode.subject` without `{code}` in
188
+ your catalogues to keep it out:
189
+
190
+ ```json
191
+ // locales/en.json
192
+ { "signInCode": { "subject": "Your sign-in code" } }
193
+ ```
194
+
195
+ ```json
196
+ // locales/fr.json
197
+ { "signInCode": { "subject": "Votre code de connexion" } }
198
+ ```
199
+
200
+ Samples:
201
+ [en](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/en/sign-in-code.html) ·
202
+ [fr](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/fr/sign-in-code.html).
203
+
204
+ ## `magic-link`
205
+
206
+ <img src="https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/en/magic-link.png" width="420" alt="The magic-link e-mail, in English">
207
+
208
+ [In French](https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/fr/magic-link.png)
209
+
210
+ A one-time link that signs the user in. A title with the brand, the body,
211
+ the **Sign in** button, the link as text, and `common.footer.ignore`. No
212
+ greeting.
213
+
214
+ | Key | `en` | `fr` |
215
+ | --- | --- | --- |
216
+ | `magicLink.subject` | Your sign-in link | Votre lien de connexion |
217
+ | `magicLink.preheader` | One click to sign in. | Un clic pour vous connecter. |
218
+ | `magicLink.title` | Sign in to {brand} | Connectez-vous à {brand} |
219
+ | `magicLink.body` | Click the button below to sign in. The link works once. | Cliquez sur le bouton ci-dessous pour vous connecter. Le lien ne fonctionne qu'une fois. |
220
+ | `magicLink.action` | Sign in | Me connecter |
221
+
222
+ Placeholders: `link` (a URL). Samples:
223
+ [en](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/en/magic-link.html) ·
224
+ [fr](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/fr/magic-link.html).
225
+
226
+ ## `new-sign-in`
227
+
228
+ <img src="https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/en/new-sign-in.png" width="420" alt="The new-sign-in e-mail, in English">
229
+
230
+ [In French](https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/fr/new-sign-in.png)
231
+
232
+ An alert, after an account was signed in from a device not seen before. A
233
+ title, the greeting, a warning banner, a summary of the device, the location
234
+ and the time, the body with `presets.notYou`, the **Secure my account**
235
+ button, and the link as text.
236
+
237
+ | Key | `en` | `fr` |
238
+ | --- | --- | --- |
239
+ | `newSignIn.subject` | New sign-in to your account | Nouvelle connexion à votre compte |
240
+ | `newSignIn.preheader` | Your account was signed in from a new device. | Votre compte a été utilisé depuis un nouvel appareil. |
241
+ | `newSignIn.title` | New sign-in to your account | Nouvelle connexion à votre compte |
242
+ | `newSignIn.banner` | Your account was signed in from a device we had not seen. | Votre compte a été utilisé depuis un appareil que nous ne connaissions pas. |
243
+ | `newSignIn.device` | Device | Appareil |
244
+ | `newSignIn.location` | Location | Lieu |
245
+ | `newSignIn.time` | Time | Heure |
246
+ | `newSignIn.body` | If this was you, there is nothing to do. | Si c'était vous, vous n'avez rien à faire. |
247
+ | `newSignIn.action` | Secure my account | Sécuriser mon compte |
248
+
249
+ Placeholders: `name`, `device`, `location`, `time`, `link` (a URL).
250
+ `device`, `location` and `time` are text the sender writes: the build cannot
251
+ format a value it does not have, so format `time` in the recipient's locale
252
+ and time zone before sending (`2 janvier 2026, 14:05 (Paris)`). Samples:
253
+ [en](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/en/new-sign-in.html) ·
254
+ [fr](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/fr/new-sign-in.html).
255
+
256
+ ## `welcome`
257
+
258
+ <img src="https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/en/welcome.png" width="420" alt="The welcome e-mail, in English">
259
+
260
+ [In French](https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/fr/welcome.png)
261
+
262
+ After an account was created. A title with the brand, the greeting, the body,
263
+ the **Get started** button, and the link as text.
264
+
265
+ | Key | `en` | `fr` |
266
+ | --- | --- | --- |
267
+ | `welcome.subject` | Welcome, {name} | Bienvenue, {name} |
268
+ | `welcome.preheader` | Your account is ready. | Votre compte est prêt. |
269
+ | `welcome.title` | Welcome to {brand} | Bienvenue chez {brand} |
270
+ | `welcome.body` | Your account is ready. Everything you need is one click away. | Votre compte est prêt. Tout ce dont vous avez besoin est à portée de clic. |
271
+ | `welcome.action` | Get started | Commencer |
272
+
273
+ Placeholders: `name` (in the subject too), `link` (a URL). Samples:
274
+ [en](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/en/welcome.html) ·
275
+ [fr](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/fr/welcome.html).
276
+
277
+ ## `invitation`
278
+
279
+ <img src="https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/en/invitation.png" width="420" alt="The invitation e-mail, in English">
280
+
281
+ [In French](https://raw.githubusercontent.com/softistx/nxgt-mail/refs/tags/@nxgt/mail-presets@0.1.0/packages/mail-presets/previews/fr/invitation.png)
282
+
283
+ To invite someone — who may have no account yet — to join an organisation.
284
+ A title with the organisation, the body naming who invites, the
285
+ **Accept the invitation** button, and the link as text. No greeting: the
286
+ recipient's name is often unknown.
287
+
288
+ | Key | `en` | `fr` |
289
+ | --- | --- | --- |
290
+ | `invitation.subject` | {inviter} invited you to join {organization} | {inviter} vous invite à rejoindre {organization} |
291
+ | `invitation.preheader` | Join {organization} on {brand}. | Rejoignez {organization} sur {brand}. |
292
+ | `invitation.title` | Join {organization} | Rejoignez {organization} |
293
+ | `invitation.body` | {inviter} invited you to join {organization} on {brand}. | {inviter} vous invite à rejoindre {organization} sur {brand}. |
294
+ | `invitation.action` | Accept the invitation | Accepter l'invitation |
295
+
296
+ Placeholders: `inviter`, `organization` (both in the subject too), `link`
297
+ (a URL). Samples:
298
+ [en](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/en/invitation.html) ·
299
+ [fr](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-presets/samples/fr/invitation.html).
300
+
301
+ ## Rewording one
302
+
303
+ Any key above can be overridden in your `locales/<locale>.json`, key by key.
304
+ The arguments are what an override must respect:
305
+
306
+ - **In the fallback locale** (`en` unless you set `fallbackLocale`), keep
307
+ every argument of a message the template passes arguments to. The
308
+ template still passes them, and the build fails on one the message no
309
+ longer uses: `i18n: en: welcome passes {brand} to welcome.title, which does
310
+ not use it`.
311
+ - **In another locale**, an override may leave an argument out, never use
312
+ one the fallback locale's message does not declare:
313
+ `i18n: fr: welcome.subject uses {extra}, which en does not declare`.
314
+ - **A subject** is not passed arguments by the template: each of its
315
+ arguments becomes a placeholder the sender fills. Dropping `{code}` from
316
+ `signInCode.subject` is fine in both locales at once; adding `{brand}` to a
317
+ subject would add a `brand` placeholder, not your brand's name.
318
+
319
+ ```json
320
+ // locales/en.json
321
+ {
322
+ "welcome": { "subject": "Welcome to Acme, {name}" },
323
+ "verifyEmail": { "action": "Yes, this is my address" }
324
+ }
325
+ ```
326
+
327
+ To drop an argument from a body message, replace the template, which then
328
+ passes what its messages use. See
329
+ [Wiring the presets](presets.md#overriding-a-message).
330
+
331
+ ## See also
332
+
333
+ - [Wiring the presets](presets.md) — `presets()`, replacing a template,
334
+ another locale.
335
+ - `@nxgt/mail-i18n`'s
336
+ [The manifest](https://github.com/softistx/nxgt-mail/blob/develop/packages/mail-i18n/docs/guide/manifest.md)
337
+ — `variables`, `urlVariables` and `subject`, field by field.