Skip to content

Conversation

@stb13579
Copy link
Contributor

@stb13579 stb13579 commented May 3, 2022

What does it do?

  • Update the email plugin documentation to match the docs style.
  • Add more complete examples to the documentation.

Why is it needed?

Describe the issue you are solving.

Related issue(s)/PR(s)

Let us know if this is related to any issue/pull request

@vercel
Copy link

vercel bot commented May 3, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
documentation ✅ Ready (Inspect) Visit Preview Jul 11, 2022 at 11:22AM (UTC)

@stb13579 stb13579 added source: Dev Docs PRs/issues targeting the Developer Docs internal PRs created by the Strapi core team target: v4 Documentation PRs/issues targeting content from docs.strapi.io (main branch). size: medium If the PR includes 1+ file(s) with a total of 10 to 50 lines of text or <100 lines of code labels May 4, 2022
Copy link
Collaborator

@pwizla pwizla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Shaun. I've added some comments and questions.

On top of that, I think some of the questions or concerns that were raised in the first round of reviews were not handled, but I can't see check as they were already marked as resolved. For further reviews or next PRs, could you please reply directly to comments? It will be easier to follow up.

|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------|----------|---------|
| `emailOptions` | Contains email addressing properties: `to`, `from`, `replyTo`, `cc`, and `bcc` | `object` | { } |
| `emailTemplate` | Contains email content properties: `subject`, `text`, and `html` using [Lodash string templates](https://lodash.com/docs/4.17.15#template) | `object` | { } |
| `data` | Contains the data used to compile the templates | `object` | { } |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data seems optional (I can't find it in the code example, maybe I misunderstood something 🤔) so I think you can mention it in the table (e.g. "data
(optional)"
The intro paragraph implies that emailOptions is optional as well, but is it? I'm trying to figure out how the email is sent if neither to or from parameters are defined (just an open question) 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added "optional" to the table.

I think the answer is because you can also hard code the email address information. Here the source code, which as I understand, only throws an error is emailTemplate is not supplied.

  const attributes = ['subject', 'text', 'html'];
  const missingAttributes = _.difference(attributes, Object.keys(emailTemplate));
  if (missingAttributes.length > 0) {
    throw new Error(
      `Following attributes are missing from your email template : ${missingAttributes.join(', ')}`
    );
  }```


### Using the `send()` function

To trigger an email in response to a user action add the following function to a [controller](/developer-docs/latest/development/backend-customization/controllers.md) or [service](/developer-docs/latest/development/backend-customization/services.md).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be worth adding a table here, for the parameters.
Generally, the structure of this kind of subsection is:

  1. little introduction to get the context and understand what the described product item does
  2. more details if necessary (here, parameters — we need to know which are optional, for instance, and the accepted types for each parameter)
  3. an example (code example in dev docs, usually)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

table added. and sentence added to the paragraph.

Co-authored-by: Pierre Wizla <pwizla@users.noreply.github.com>
@stb13579
Copy link
Contributor Author

stb13579 commented Jul 8, 2022

Thanks, Shaun. I've added some comments and questions.

On top of that, I think some of the questions or concerns that were raised in the first round of reviews were not handled, but I can't see check as they were already marked as resolved. For further reviews or next PRs, could you please reply directly to comments? It will be easier to follow up.

I went back and commented on the earlier comments

@stb13579 stb13579 changed the title dev/email plugin docs update [WIP] dev/email plugin docs update Jul 11, 2022
@pwizla
Copy link
Collaborator

pwizla commented Jul 13, 2022

Closed in favor of #992, thank you, guys!

@pwizla pwizla closed this Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal PRs created by the Strapi core team size: medium If the PR includes 1+ file(s) with a total of 10 to 50 lines of text or <100 lines of code source: Dev Docs PRs/issues targeting the Developer Docs target: v4 Documentation PRs/issues targeting content from docs.strapi.io (main branch).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants