You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Parse Server API Mail Adapter enables Parse Server to send emails using any 3rd party API with built-in dynamic templates and localization.
11
11
12
-
# Content
12
+
# Content<!-- omit in toc -->
13
13
14
-
-[Installation](#Installation)
14
+
-[Installation](#installation)
15
15
-[Demo](#demo)
16
16
-[Configuration](#configuration)
17
17
-[Templates](#templates)
18
+
-[Placeholders](#placeholders)
19
+
-[Password Reset and Email Verification](#password-reset-and-email-verification)
18
20
-[Localization](#localization)
19
21
-[Need help?](#need-help)
20
22
@@ -147,29 +149,33 @@ There are different files for different parts of the email:
147
149
- plain-text content (`textPath`)
148
150
- HTML content (`htmlPath`)
149
151
152
+
See the [templates](https://github.com/mtrezza/parse-server-api-mail-adapter/tree/main/spec/templates) for examples how placeholders can be used.
153
+
150
154
# Placeholders
151
-
Placeholders allow to dynamically insert text into the template file content. The placeholders are filled in according to the key-value definitions returned by the placeholder callback in the adapter configuration.
155
+
Placeholders allow to dynamically insert text into the template content. The placeholder values are filled in according to the key-value definitions returned by the placeholder callback in the adapter configuration.
152
156
153
157
This is using the [mustache](http://mustache.github.io/mustache.5.html) template syntax. The most commonly used tags are:
154
158
-`{{double-mustache}}`: The most basic form of tag; inserts text as HTML escaped by default.
155
159
-`{{{triple-mustache}}}`: Inserts text with unescaped HTML, which is required to insert a URL for example.
156
160
161
+
### Password Reset and Email Verification
162
+
157
163
By default, the following placeholders are available in the password reset and email verification templates:
158
-
-`appName`: The app name as defined in the Parse Server configuration.
159
-
-`username`: The username of the user who requested the email.
160
-
-`link`: The URL to the password reset or email verification form.
164
+
-`{{appName}}`: The app name as set in the Parse Server configuration.
165
+
-`{{username}}`: The username of the user who requested the email.
166
+
-`{{link}}`: The URL to the Parse Server endpoint for password reset or email verification.
161
167
162
168
# Localization
163
169
164
170
Localization allows to use a specific template depending on the user locale. To turn on localization for a template, add a `localeCallback` to the template configuration.
165
171
166
-
The locale returned by `localeCallback` will be used to look for locale-specific template files. If the callback return an invalid locale or nothing at all (`undefined`), localization will be ignored and the default files will be used.
172
+
The locale returned by `localeCallback` will be used to look for locale-specific template files. If the callback returns an invalid locale or nothing at all (`undefined`), localization will be ignored and the default files will be used.
167
173
168
174
The locale-specific files are placed in subfolders with the name of either the whole locale (e.g. `de-AT`), or only the language (e.g. `de`). The locale has to be in format `[language]-[country]` as specified in [IETF BCP 47](https://tools.ietf.org/html/bcp47), e.g. `de-AT`.
169
175
170
176
Localized files are placed in subfolders of the given path, for example:
171
-
```
172
-
path/
177
+
```js
178
+
base/
173
179
├── example.html// default file
174
180
└── de/// de language folder
175
181
│ └── example.html// de localized file
@@ -178,11 +184,11 @@ path/
178
184
```
179
185
180
186
Files are matched with the user locale in the following order:
181
-
1. Locale match, e.g. locale `de-AT` matches file in folder `de-AT`.
182
-
2. Language match, e.g. locale `de-AT` matches file in folder `de`.
183
-
3. Default match: file in base folder is returned.
187
+
1.**Locale** (locale `de-AT` matches file in folder `de-AT`)
188
+
2.**Language** (locale `de-AT` matches file in folder `de` if there is no file in folder `de-AT`)
189
+
3.**Default** (default file in base folder is returned if there is no file in folders `de-AT` and `de`)
184
190
185
191
# Need help?
186
192
187
-
- Ask on StackOverflow using the tag [parse-server](https://stackoverflow.com/questions/tagged/parse-server).
188
-
- Search through existing issues or open a new issue.
193
+
- Ask on StackOverflow using the [parse-server](https://stackoverflow.com/questions/tagged/parse-server) tag.
194
+
- Search through existing [issues](https://github.com/mtrezza/parse-server-api-mail-adapter/issues) or open a new issue.
0 commit comments