@macaw-email/provider-sendgrid
npm i @macaw-email/provider-sendgrid

@macaw-email/provider-sendgrid

🦜 Scalable email templates for Node.js applications.

by macaw-email

1.2.2 (see all)License:MITTypeScript:Not Found
npm i @macaw-email/provider-sendgrid
Readme

Sendgrid provider for Macaw

Macaw is a simple library to streamline email templating.

Quickstart

Please start by looking at the Macaw documentation.

First install the Sendgrid provider package:

yarn add @macaw-email/provider-sendgrid

When initiating your instance of Macaw, pass in Sendgrid as your provider:

const sendgrid = require("@macaw-email/provider-sendgrid");

const mailer = macaw({
  provider: sendgrid({ apiKey: "aaaaa-bbbbbbb-ccccccc-ddddddd" })
});

You can find your API key in the Sendgrid developer console.

Then you can load a template and send it:

const template = await mailer.template("monthly-newsletter", {
  greeting: "Hello, world"
});

await template.send({
  subject: "Hello, world!",
  to: {
    name: "Thomas Schoffelen",
    email: "thomas@schof.co"
  },
  from: {
    name: "Mark from Startup X",
    email: "noreply@startup-x.com"
  }
});

The template.send() function accepts any parameters that are accepted by the Sendgrid Node API. It requires at least a subject, to and from field to be set.

Downloads/wk

1

GitHub Stars

24

LAST COMMIT

2mos ago

MAINTAINERS

1

CONTRIBUTORS

3

OPEN ISSUES

1

OPEN PRs

0
VersionTagPublished
1.2.2
latest
2yrs ago
No alternatives found
No tutorials found
Add a tutorial