the-mail
Version:
Mail client for the-framework
23 lines (20 loc) • 421 B
JavaScript
/**
* @function sendSendgrid
*/
/** @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