docs: show how to use the sendgrid plugin dynamically. (#3679)

* Updating documentation to show how to use the plugin dynamically.

* Updating documentation to show how to use the sendgrid plugin dynamically.

* Update docs/content/plugins/notifications/sendgrid.mdx

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>

* Revert "Updating documentation to show how to use the plugin dynamically."

This reverts commit d81c097b1a4637ca773f83f3aa5673bbed58e0f8.

* Adding language type to code sample

* fixed eslint errors

---------

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
This commit is contained in:
thephpguy
2023-04-06 06:02:23 -04:00
committed by GitHub
parent 713d85a92c
commit 16f73baca1

View File

@@ -3979,6 +3979,24 @@ You can also track analytics related to emails sent from the SendGrid dashboard.
---
## Dynamic usage
You can resolve the SendGrid service to send emails from your custom services or other resources. For example:
```ts
const sendgridService = scope.resolve("sendgridService")
const sendOptions = {
templateId: "d-123....",
from: "ACME <acme@mail.com>",
to: "customer@mail.com",
data: { dynamic: "data" },
}
sendgridService.sendEmail(sendOptions)
```
---
## See Also
- [Notifications Overview](../../development/notification/overview.mdx)