1.2.2 • Published 4 years ago
@macaw-email/provider-sendgrid v1.2.2
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.
1.2.2
4 years ago
1.1.7
5 years ago
1.1.6
5 years ago
1.1.5
5 years ago
1.0.7
5 years ago
1.0.2
5 years ago
1.0.4
5 years ago
1.0.0-alpha.1
5 years ago
1.0.0-alpha.0
5 years ago