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
Copy file name to clipboardExpand all lines: docusaurus/docs/dev-docs/plugins/email.md
+27-5Lines changed: 27 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,28 @@ The Email plugin requires a provider and a provider configuration in the `config
27
27
[`Sendmail`](https://www.npmjs.com/package/sendmail) is the default email provider in the Strapi Email plugin. It provides functionality for the local development environment but is not production-ready in the default configuration. For production stage applications you need to further configure `Sendmail` or change providers. The [Providers](/dev-docs/providers) documentation has instructions for changing providers, configuring providers, and creating a new email provider.
28
28
:::
29
29
30
+
## Email Configuration Options
31
+
32
+
Plugins configuration are defined in the `config/plugins.js` file or `config/plugins.ts` file. For provider specific configuration please see the [Providers](/dev-docs/providers) documentation for detailed installation and configuration instructions.
33
+
34
+
| Option | Type | Description | Default Value | Notes |
|`provider`|`string`| The email provider to use. |`sendmail`| Required |
37
+
|`providerOptions`|`object`| The email provider options. |`{}`| Optional |
38
+
|`providerOptions.apiKey`|`string`| The API key for the email provider. |`''`| Optional |
39
+
|`settings`|`object`| The email settings. |`{}`| Optional |
40
+
|`settings.defaultFrom`|`string`| The default email address to use as the sender. |`''`| Optional |
41
+
|`settings.defaultReplyTo`|`string`| The default email address to use as the reply-to address. |`''`| Optional |
42
+
|`ratelimit`|`object`| The email rate limit settings. |`{}`| Optional |
43
+
|`ratelimit.enabled`|`boolean`| Whether to enable rate limiting. |`true`| Optional |
44
+
|`ratelimit.interval`|`string`| The interval for rate limiting in minutes. |`5`| Optional |
45
+
|`ratelimit.max`|`number`| The maximum number of requests allowed during the interval. |`5`| Optional |
46
+
|`ratelimit.delayAfter`|`number`| The number of requests allowed before rate limiting is applied. |`1`| Optional |
47
+
|`ratelimit.timeWait`|`number`| Time to wait before responding to a request (in milliseconds). |`1`| Optional |
48
+
|`ratelimit.prefixKey`|`string`| The prefix for the rate limit key. |`${userEmail}`| Optional |
49
+
|`ratelimit.whitelist`|`array(string)`| Array of IP addresses to whitelist from rate limiting. |`[]`| Optional |
50
+
|`ratelimit.store`|`object`| Rate limiting storage location and for more information please see the [`koa2-ratelimit documentation`](https://www.npmjs.com/package/koa2-ratelimit). |`MemoryStore`| Optional |
51
+
30
52
## Sending emails with a controller or service
31
53
32
54
The Email plugin has an `email`[service](/dev-docs/backend-customization/services) that contains 2 functions to send emails:
@@ -67,11 +89,11 @@ To trigger an email in response to a user action add the `send()` function to a
67
89
68
90
The `sendTemplatedEmail()` function is used to compose emails from a template. The function compiles the email from the available properties and then sends the email. To use the `sendTemplatedEmail()` function, define the `emailTemplate` object and add the function to a controller or service. The function calls the `emailTemplate` object, and can optionally call the `emailOptions` and `data` objects:
|`emailTemplate`| Contains email content properties: `subject`, `text`, and `html` using [Lodash string templates](https://lodash.com/docs/4.17.15#template)|`object`| { } |
96
+
|`data` <br/> Optional | Contains the data used to compile the templates |`object`| { } |
75
97
76
98
```js title="This code example can be used in a controller or a service path: ./src/api/{api name}/controllers/{api name}.js or ./src/api/{api name}/services/{api name}.js"
0 commit comments