Replace mailjet with mailgun (#180)

This commit is contained in:
Rafael Taranto 2018-10-04 15:40:50 -03:00 committed by Josh Harvey
parent 6a2e3bc348
commit 3b14a715b4
7 changed files with 245 additions and 36 deletions

View file

@ -0,0 +1,21 @@
const Mailgun = require('mailgun-js')
const NAME = 'Mailgun'
function sendMessage ({apiKey, domain, fromEmail, toEmail}, rec) {
const mailgun = Mailgun({apiKey, domain})
const emailData = {
from: `Lamassu Server ${fromEmail}`,
to: toEmail,
subject: rec.email.subject,
text: rec.email.body
}
return mailgun.messages().send(emailData)
}
module.exports = {
NAME,
sendMessage
}