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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user