Skip to content

Commit dac7fc1

Browse files
enhancement: add email ratelimiting config options (#2377)
* enhancement: add email ratelimiting config options * Revert "enhancement: add email ratelimiting config options" This reverts commit d3125c1. * fix: fix removing some sections by accident --------- Co-authored-by: Pierre Wizla <pwizla@users.noreply.github.com>
1 parent 3297647 commit dac7fc1

File tree

1 file changed

+27
-5
lines changed
  • docusaurus/docs/dev-docs/plugins

1 file changed

+27
-5
lines changed

docusaurus/docs/dev-docs/plugins/email.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,28 @@ The Email plugin requires a provider and a provider configuration in the `config
2727
[`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.
2828
:::
2929

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 |
35+
|---------------------------|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|----------|
36+
| `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+
3052
## Sending emails with a controller or service
3153

3254
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
6789

6890
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:
6991

70-
| Parameter | Description | Type | Default |
71-
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------|----------|---------|
72-
| `emailOptions` <br/> Optional | Contains email addressing properties: `to`, `from`, `replyTo`, `cc`, and `bcc` | `object` | { } |
73-
| `emailTemplate` | Contains email content properties: `subject`, `text`, and `html` using [Lodash string templates](https://lodash.com/docs/4.17.15#template) | `object` | { } |
74-
| `data` <br/> Optional | Contains the data used to compile the templates | `object` | { } |
92+
| Parameter | Description | Type | Default |
93+
|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|----------|---------|
94+
| `emailOptions` <br/> Optional | Contains email addressing properties: `to`, `from`, `replyTo`, `cc`, and `bcc` | `object` | { } |
95+
| `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` | { } |
7597

7698
```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"
7799

0 commit comments

Comments
 (0)