UNPKG

the-mail

Version:
23 lines (20 loc) 421 B
/** * @function sendSendgrid */ 'use strict' /** @lends sendSendgrid */ async function sendSendgrid({ content, from, key, subject, to }) { if (!key) { throw new Error(`key is required for send grid`) } const sendgrid = require('@sendgrid/mail') sendgrid.setApiKey(key) const config = { from, html: content, subject, to, } return sendgrid.send(config) } module.exports = sendSendgrid