1.0.10 • Published 2 years ago
@novo-x/sendgrid v1.0.10
Sendgrid Service
Available methods
- sendEmail: sends an email
Usage examples
yarn add @novo-x/sendgrid
import {Sendgrid} from "@novo-x/sendgrid"
const MyService = new Sendgrid(
'123456789', // apiKey,
"from@email.com" // sender
);
const sent = MyService.sendEmail(
'to@email.com', // Receiver,
'123456789', // Template id
{ someField: someValue }, // Optional data to be replaced in the template
{ someField: someValue }, // Optional headers
{ someField: someValue }, // Optional extra config
);
const sent = MyService.sendEmailWithAttachmebt(
'to@email.com', // Receiver,
'123456789', // Template id
'ASJKDHASKLDJKAKSJDKAJSD9283', // File stream
{ // File metadata
filename: 'my_file.pdf', // File name
contentType: 'application/pdf' // File content type
},
{ someField: someValue }, // Optional data to be replaced in the template
{ someField: someValue }, // Optional headers
{ someField: someValue }, // Optional extra config
);