From 16f73baca19bfd02e41ad80cf935e2c573d34d82 Mon Sep 17 00:00:00 2001 From: thephpguy Date: Thu, 6 Apr 2023 06:02:23 -0400 Subject: [PATCH] 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 * 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 --- .../content/plugins/notifications/sendgrid.mdx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/content/plugins/notifications/sendgrid.mdx b/docs/content/plugins/notifications/sendgrid.mdx index d154498db8..96cbead9e2 100644 --- a/docs/content/plugins/notifications/sendgrid.mdx +++ b/docs/content/plugins/notifications/sendgrid.mdx @@ -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 ", + to: "customer@mail.com", + data: { dynamic: "data" }, + } + +sendgridService.sendEmail(sendOptions) +``` + +--- + ## See Also - [Notifications Overview](../../development/notification/overview.mdx)