strapi/docs/v3.x/admin-panel/forgot-password.md
Pierre Noël e000432027 add the possibility to edit the template for the forgot password email
Signed-off-by: Pierre Noël <petersg83@gmail.com>
2020-07-08 11:41:18 +02:00

49 lines
1.1 KiB
Markdown

# Forgot Password Email
## Customize forgot password email
You may want to customize the forgot password email.
You can do it by providing your own template (formatted as a [lodash template](https://lodash.com/docs/4.17.15#template)).
The template will be compiled with the following variables: `url`, `user.email`, `user.username`, `user.firstname`, `user.lastname`.
### Example
**Path -** `./config/servers.js`
```js
const forgotPasswordTemplate = require('./email-templates/forgot-password');
module.exports = ({ env }) => ({
// ...
admin: {
// ...
forgotPassword: {
from: 'support@mywebsite.fr',
replyTo: 'support@mywebsite.fr',
emailTemplate: forgotPasswordTemplate,
},
// ...
},
// ...
});
```
**Path -** `./config/email-templates/forgot-password.js`
```js
const subject = `Reset password`;
const html = `<p>Hi <%= user.firstname %></p>
<p>Sorry you lost your password. You can click here to reset it: <%= url %></p>`;
const text = `Hi <%= user.firstname %>
Sorry you lost your password. You can click here to reset it: <%= url %>`;
module.exports = {
subject,
text,
html,
};
```